diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 581015ff..e5946b89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: push: branches: [ "main", "*-rc" ] pull_request: - branches: [ "main", "*-rc" ] + branches: [ "main", "*-rc", "release/3.x" ] jobs: build: diff --git a/README.md b/README.md index 17d9ac76..83a054fc 100644 --- a/README.md +++ b/README.md @@ -70,12 +70,31 @@ _NOTE:_ Ensure you have an active Individual Contributor License Agreement (ICLA For further inquiries, email [help@finos.org](mailto:help@finos.org). - ### Updating Generated Code Python BDK uses [OpenAPITools/openapi-generator](https://github.com/OpenAPITools/openapi-generator/) to generate code. To update the generated code, follow these steps: +1. Download desired version of openapi generator. + ```bash + cd api_client_generation + curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.14.0/openapi-generator-cli-7.14.0.jar -o openapi-generator-cli.jar + ``` +2. Adjust the commit for which the code is generated(inside generate.sh script) +3. Execute the generation script: + ```bash + ./generate.sh + ``` +4. Commit and push the newly generated code along with the updated JAR file. + +Note: There are a few files that are not replaced(EX. api_client.py), those files require some modifications after code is generated. + + +### OLD Updating Generated Code (Deprecated) + +Python BDK uses [OpenAPITools/openapi-generator](https://github.com/OpenAPITools/openapi-generator/) to generate code. +To update the generated code, follow these steps: + 1. Checkout the latest branch of the fork (e.g., [sym-python-5.5.0](https://github.com/SymphonyPlatformSolutions/openapi-generator/tree/sym-python-5.5.0)). 2. Update the fork source code, review, and merge it. 3. Generate the JAR file in `openapi-generatormodules/openapi-generator-cli/target/openapi-generator-cli.jar`: diff --git a/api_client_generation/generate.sh b/api_client_generation/generate.sh index 2a50b49b..d4a80941 100755 --- a/api_client_generation/generate.sh +++ b/api_client_generation/generate.sh @@ -4,92 +4,113 @@ code_gen_dir=`pwd` project_root=$code_gen_dir/.. echo $code_gen_dir -commit_hash=b63d67cc0ed7c5a3962e72f21001df4d2ed482f2 +commit_hash=64977061b376680aaf09b088877bcaa9c3acc6a8 api_spec_base_url=https://raw.githubusercontent.com/symphonyoss/symphony-api-spec/${commit_hash} echo $api_spec_base_url -#local_api_spec_base_url=./local - # This function accepts the following parameters (in order): # - name of the module we want to generate # - uri of the file to be used for generation # - uri of the support file needed for the generation download_and_generate_files() { - name=$1 - file_url=$2 - file_name=${file_url##*/} - support_file_url=$3 - support_file_name=${support_file_url##*/} - - download_files ${file_url} ${file_name} ${support_file_url} ${support_file_name} - generate_files ${name} ${file_name} - cleanup_files ${file_name} ${support_file_name} + name=$1 + file_url=$2 + file_name=${file_url##*/} + support_file_url=$3 + support_file_name=${support_file_url##*/} + + download_files "${file_url}" "${file_name}" "${support_file_url}" "${support_file_name}" + generate_files "${name}" "${file_name}" + cleanup_files "${file_name}" "${support_file_name}" } download_files() { - # download files - file_url=$1 - file_name=$2 - support_file_url=$3 - support_file_name=$4 - - cd $code_gen_dir - curl $file_url -o $file_name - if [ ! -z "${support_file_name}" ] - then - curl $support_file_url -o $support_file_name - fi + file_url=$1 + file_name=$2 + support_file_url=$3 + support_file_name=$4 + + cd "$code_gen_dir" + curl -s "$file_url" -o "$file_name" + if [ -n "$support_file_name" ]; then + curl -s "$support_file_url" -o "$support_file_name" + fi } generate_files() { - - name=$1 - file_name=$2 - - # generate files - java -jar openapi-generator-cli.jar generate -g python -i $file_name --package-name symphony.bdk.gen -o output - - # update api files - cd $code_gen_dir/output/symphony/bdk/gen/api/ - sed -i "s/symphony\.bdk\.gen\.model\./symphony\.bdk\.gen\.${name}_model\./g" *.py - sed -i "s/ api\./ ${name}_api\./g" *.py - rm __init__.py # we don't care about __init__.py files - cp *.py $project_root/symphony/bdk/gen/${name}_api - - # update model files - cd $code_gen_dir/output/symphony/bdk/gen/model/ - sed -i "s/symphony\.bdk\.gen\.model\./symphony\.bdk\.gen\.${name}_model\./g" *.py - sed -i "s/model /${name}_model /g" *.py - rm __init__.py # we don't care about __init__.py files - cp *.py $project_root/symphony/bdk/gen/${name}_model - - # update rest.py - cd $code_gen_dir/output/symphony/bdk/gen - cp rest.py $project_root/symphony/bdk/gen/rest.py - - cd $code_gen_dir - rm -r output + name=$1 + file_name=$2 + + # Generate files + java -jar openapi-generator-cli.jar generate -g python -i "$file_name" --library asyncio --package-name symphony.bdk.gen -o output + + # Define source and destination directories + new_api_dir="$code_gen_dir/output/symphony/bdk/gen/api/" + new_models_dir="$code_gen_dir/output/symphony/bdk/gen/models/" + final_models_dir="$project_root/symphony/bdk/gen/${name}_model/" + final_api_dir="$project_root/symphony/bdk/gen/${name}_api/" + final_main_models_dir="$project_root/symphony/bdk/gen/models/" + + # Update and copy API files + echo "Updating and copying API files..." + mkdir -p "$final_api_dir" + cd "$new_api_dir" + sed -i "s/symphony\.bdk\.gen\.models\./symphony\.bdk\.gen\.${name}_model\./g" *.py + sed -i "s/ api\./ ${name}_api\./g" *.py + rm __init__.py + cp *.py "$final_api_dir" + + # Update and copy model files + echo "Updating and copying Model files..." + mkdir -p "$final_models_dir" + cd "$new_models_dir" + # Capture the imports from the generated __init__.py before removing it + # Use awk to filter out comments and empty lines and then sed to replace the import path + awk '/^from symphony\.bdk\.gen\.models\./' __init__.py | sed "s/symphony\.bdk\.gen\.models\./symphony\.bdk\.gen\.${name}_model\./" >> "$final_main_models_dir/__init__.py" + sed -i "s/symphony\.bdk\.gen\.models\./symphony\.bdk\.gen\.${name}_model\./g" *.py + rm __init__.py + + # Copy the actual model files + cp *.py "$final_models_dir" + + # The rest of the files + # Here we have more files generated that are not updated because they require changes(EX. api_client) + cd "$code_gen_dir/output/symphony/bdk/gen" + cp rest.py "$project_root/symphony/bdk/gen/rest.py" + + # Clean up + cd "$code_gen_dir" + rm -r output } cleanup_files() { - file_name=$1 - support_file_name=$2 - - # remove downloaded files - cd $code_gen_dir - rm -r output - rm $file_name - if [ ! -z "${support_file_name}" ] - then - rm $support_file_name - fi + file_name=$1 + support_file_name=$2 + + # remove downloaded files + cd "$code_gen_dir" + rm "$file_name" + if [ -n "$support_file_name" ]; then + rm "$support_file_name" + fi } +main() { + # Prepare the target directory for the models + rm -rf "$project_root/symphony/bdk/gen/models" + mkdir -p "$project_root/symphony/bdk/gen/models" + + # Add initial header to the main __init__.py + echo "# coding: utf-8" > "$project_root/symphony/bdk/gen/models/__init__.py" + echo "" >> "$project_root/symphony/bdk/gen/models/__init__.py" + echo "# This file is auto-generated by a script. Do not edit manually." >> "$project_root/symphony/bdk/gen/models/__init__.py" + echo "" >> "$project_root/symphony/bdk/gen/models/__init__.py" + + download_and_generate_files agent "${api_spec_base_url}/agent/agent-api-public-deprecated.yaml" + download_and_generate_files auth "${api_spec_base_url}/authenticator/authenticator-api-public-deprecated.yaml" + download_and_generate_files login "${api_spec_base_url}/login/login-api-public.yaml" + download_and_generate_files pod "${api_spec_base_url}/pod/pod-api-public.yaml" + download_and_generate_files group "${api_spec_base_url}/profile-manager/profile-manager-api.yaml" "${api_spec_base_url}/profile-manager/symphony-common-definitions.yaml" +} -generate_files agent ${api_spec_base_url}/agent/agent-api-public-deprecated.yaml -generate_files auth ${api_spec_base_url}/authenticator/authenticator-api-public-deprecated.yaml -generate_files login ${api_spec_base_url}/login/login-api-public.yaml -generate_files pod ${api_spec_base_url}/pod/pod-api-public.yaml -generate_files group ${api_spec_base_url}/profile-manager/profile-manager-api.yaml ${api_spec_base_url}/profile-manager/symphony-common-definitions.yaml - -#generate_files agent ${local_api_spec_base_url}/agent-api-public-deprecated-formValues-modified.yaml +main \ No newline at end of file diff --git a/api_client_generation/openapi-generator-cli.jar b/api_client_generation/openapi-generator-cli.jar index 51c3085b..d44483b0 100644 Binary files a/api_client_generation/openapi-generator-cli.jar and b/api_client_generation/openapi-generator-cli.jar differ diff --git a/poetry.lock b/poetry.lock index 620cb2bd..b65dab6d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.0.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.3 and should not be changed by hand. [[package]] name = "aiohappyeyeballs" @@ -119,7 +119,22 @@ propcache = ">=0.2.0" yarl = ">=1.17.0,<2.0" [package.extras] -speedups = ["Brotli", "aiodns (>=3.3.0)", "brotlicffi"] +speedups = ["Brotli ; platform_python_implementation == \"CPython\"", "aiodns (>=3.3.0)", "brotlicffi ; platform_python_implementation != \"CPython\""] + +[[package]] +name = "aiohttp-retry" +version = "2.9.1" +description = "Simple retry client for aiohttp" +optional = false +python-versions = ">=3.7" +groups = ["main"] +files = [ + {file = "aiohttp_retry-2.9.1-py3-none-any.whl", hash = "sha256:66d2759d1921838256a05a3f80ad7e724936f083e35be5abb5e16eed6be6dc54"}, + {file = "aiohttp_retry-2.9.1.tar.gz", hash = "sha256:8eb75e904ed4ee5c2ec242fefe85bf04240f685391c4879d8f541d6028ff01f1"}, +] + +[package.dependencies] +aiohttp = "*" [[package]] name = "aiosignal" @@ -149,6 +164,18 @@ files = [ {file = "alabaster-0.7.13.tar.gz", hash = "sha256:a27a4a084d5e690e16e01e03ad2b2e552c61a65469419b907243193de1a84ae2"}, ] +[[package]] +name = "annotated-types" +version = "0.7.0" +description = "Reusable constraint types to use with typing.Annotated" +optional = false +python-versions = ">=3.8" +groups = ["main"] +files = [ + {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, + {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, +] + [[package]] name = "async-timeout" version = "4.0.3" @@ -175,12 +202,12 @@ files = [ ] [package.extras] -benchmark = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -cov = ["cloudpickle", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -dev = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +benchmark = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\"", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\" and python_version < \"3.13\"", "pytest-xdist[psutil]"] +cov = ["cloudpickle ; platform_python_implementation == \"CPython\"", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\"", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\" and python_version < \"3.13\"", "pytest-xdist[psutil]"] +dev = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\"", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\" and python_version < \"3.13\"", "pytest-xdist[psutil]"] docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier (<24.7)"] -tests = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"] +tests = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\"", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\" and python_version < \"3.13\"", "pytest-xdist[psutil]"] +tests-mypy = ["mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\"", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\" and python_version < \"3.13\""] [[package]] name = "babel" @@ -547,7 +574,7 @@ files = [ tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} [package.extras] -toml = ["tomli"] +toml = ["tomli ; python_full_version <= \"3.11.0a6\""] [[package]] name = "cryptography" @@ -600,10 +627,10 @@ files = [ cffi = {version = ">=1.12", markers = "platform_python_implementation != \"PyPy\""} [package.extras] -docs = ["sphinx (>=5.3.0)", "sphinx-rtd-theme (>=3.0.0)"] +docs = ["sphinx (>=5.3.0)", "sphinx-rtd-theme (>=3.0.0) ; python_version >= \"3.8\""] docstest = ["pyenchant (>=3)", "readme-renderer (>=30.0)", "sphinxcontrib-spelling (>=7.3.1)"] -nox = ["nox (>=2024.4.15)", "nox[uv] (>=2024.3.2)"] -pep8test = ["check-sdist", "click (>=8.0.1)", "mypy (>=1.4)", "ruff (>=0.3.6)"] +nox = ["nox (>=2024.4.15)", "nox[uv] (>=2024.3.2) ; python_version >= \"3.8\""] +pep8test = ["check-sdist ; python_version >= \"3.8\"", "click (>=8.0.1)", "mypy (>=1.4)", "ruff (>=0.3.6)"] sdist = ["build (>=1.0.0)"] ssh = ["bcrypt (>=3.1.5)"] test = ["certifi (>=2024)", "cryptography-vectors (==44.0.3)", "pretend (>=0.7)", "pytest (>=7.4.0)", "pytest-benchmark (>=4.0)", "pytest-cov (>=2.10.1)", "pytest-xdist (>=3.5.0)"] @@ -696,7 +723,7 @@ files = [ [package.extras] docs = ["furo (>=2024.8.6)", "sphinx (>=8.1.3)", "sphinx-autodoc-typehints (>=3)"] testing = ["covdefaults (>=2.3)", "coverage (>=7.6.10)", "diff-cover (>=9.2.1)", "pytest (>=8.3.4)", "pytest-asyncio (>=0.25.2)", "pytest-cov (>=6)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.28.1)"] -typing = ["typing-extensions (>=4.12.2)"] +typing = ["typing-extensions (>=4.12.2) ; python_version < \"3.11\""] [[package]] name = "frozenlist" @@ -892,12 +919,12 @@ files = [ zipp = ">=3.20" [package.extras] -check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""] cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] enabler = ["pytest-enabler (>=2.2)"] perf = ["ipython"] -test = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6,!=8.1.*)", "pytest-perf (>=0.9.2)"] +test = ["flufl.flake8", "importlib-resources (>=1.3) ; python_version < \"3.9\"", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6,!=8.1.*)", "pytest-perf (>=0.9.2)"] type = ["pytest-mypy"] [[package]] @@ -1333,6 +1360,140 @@ files = [ {file = "pycparser-2.22.tar.gz", hash = "sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6"}, ] +[[package]] +name = "pydantic" +version = "2.11.7" +description = "Data validation using Python type hints" +optional = false +python-versions = ">=3.9" +groups = ["main"] +files = [ + {file = "pydantic-2.11.7-py3-none-any.whl", hash = "sha256:dde5df002701f6de26248661f6835bbe296a47bf73990135c7d07ce741b9623b"}, + {file = "pydantic-2.11.7.tar.gz", hash = "sha256:d989c3c6cb79469287b1569f7447a17848c998458d49ebe294e975b9baf0f0db"}, +] + +[package.dependencies] +annotated-types = ">=0.6.0" +pydantic-core = "2.33.2" +typing-extensions = ">=4.12.2" +typing-inspection = ">=0.4.0" + +[package.extras] +email = ["email-validator (>=2.0.0)"] +timezone = ["tzdata ; python_version >= \"3.9\" and platform_system == \"Windows\""] + +[[package]] +name = "pydantic-core" +version = "2.33.2" +description = "Core functionality for Pydantic validation and serialization" +optional = false +python-versions = ">=3.9" +groups = ["main"] +files = [ + {file = "pydantic_core-2.33.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:2b3d326aaef0c0399d9afffeb6367d5e26ddc24d351dbc9c636840ac355dc5d8"}, + {file = "pydantic_core-2.33.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0e5b2671f05ba48b94cb90ce55d8bdcaaedb8ba00cc5359f6810fc918713983d"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0069c9acc3f3981b9ff4cdfaf088e98d83440a4c7ea1bc07460af3d4dc22e72d"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d53b22f2032c42eaaf025f7c40c2e3b94568ae077a606f006d206a463bc69572"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0405262705a123b7ce9f0b92f123334d67b70fd1f20a9372b907ce1080c7ba02"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4b25d91e288e2c4e0662b8038a28c6a07eaac3e196cfc4ff69de4ea3db992a1b"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6bdfe4b3789761f3bcb4b1ddf33355a71079858958e3a552f16d5af19768fef2"}, + {file = "pydantic_core-2.33.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:efec8db3266b76ef9607c2c4c419bdb06bf335ae433b80816089ea7585816f6a"}, + {file = "pydantic_core-2.33.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:031c57d67ca86902726e0fae2214ce6770bbe2f710dc33063187a68744a5ecac"}, + {file = "pydantic_core-2.33.2-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:f8de619080e944347f5f20de29a975c2d815d9ddd8be9b9b7268e2e3ef68605a"}, + {file = "pydantic_core-2.33.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:73662edf539e72a9440129f231ed3757faab89630d291b784ca99237fb94db2b"}, + {file = "pydantic_core-2.33.2-cp310-cp310-win32.whl", hash = "sha256:0a39979dcbb70998b0e505fb1556a1d550a0781463ce84ebf915ba293ccb7e22"}, + {file = "pydantic_core-2.33.2-cp310-cp310-win_amd64.whl", hash = "sha256:b0379a2b24882fef529ec3b4987cb5d003b9cda32256024e6fe1586ac45fc640"}, + {file = "pydantic_core-2.33.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:4c5b0a576fb381edd6d27f0a85915c6daf2f8138dc5c267a57c08a62900758c7"}, + {file = "pydantic_core-2.33.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e799c050df38a639db758c617ec771fd8fb7a5f8eaaa4b27b101f266b216a246"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dc46a01bf8d62f227d5ecee74178ffc448ff4e5197c756331f71efcc66dc980f"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a144d4f717285c6d9234a66778059f33a89096dfb9b39117663fd8413d582dcc"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:73cf6373c21bc80b2e0dc88444f41ae60b2f070ed02095754eb5a01df12256de"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3dc625f4aa79713512d1976fe9f0bc99f706a9dee21dfd1810b4bbbf228d0e8a"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:881b21b5549499972441da4758d662aeea93f1923f953e9cbaff14b8b9565aef"}, + {file = "pydantic_core-2.33.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:bdc25f3681f7b78572699569514036afe3c243bc3059d3942624e936ec93450e"}, + {file = "pydantic_core-2.33.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:fe5b32187cbc0c862ee201ad66c30cf218e5ed468ec8dc1cf49dec66e160cc4d"}, + {file = "pydantic_core-2.33.2-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:bc7aee6f634a6f4a95676fcb5d6559a2c2a390330098dba5e5a5f28a2e4ada30"}, + {file = "pydantic_core-2.33.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:235f45e5dbcccf6bd99f9f472858849f73d11120d76ea8707115415f8e5ebebf"}, + {file = "pydantic_core-2.33.2-cp311-cp311-win32.whl", hash = "sha256:6368900c2d3ef09b69cb0b913f9f8263b03786e5b2a387706c5afb66800efd51"}, + {file = "pydantic_core-2.33.2-cp311-cp311-win_amd64.whl", hash = "sha256:1e063337ef9e9820c77acc768546325ebe04ee38b08703244c1309cccc4f1bab"}, + {file = "pydantic_core-2.33.2-cp311-cp311-win_arm64.whl", hash = "sha256:6b99022f1d19bc32a4c2a0d544fc9a76e3be90f0b3f4af413f87d38749300e65"}, + {file = "pydantic_core-2.33.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:a7ec89dc587667f22b6a0b6579c249fca9026ce7c333fc142ba42411fa243cdc"}, + {file = "pydantic_core-2.33.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3c6db6e52c6d70aa0d00d45cdb9b40f0433b96380071ea80b09277dba021ddf7"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e61206137cbc65e6d5256e1166f88331d3b6238e082d9f74613b9b765fb9025"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eb8c529b2819c37140eb51b914153063d27ed88e3bdc31b71198a198e921e011"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c52b02ad8b4e2cf14ca7b3d918f3eb0ee91e63b3167c32591e57c4317e134f8f"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:96081f1605125ba0855dfda83f6f3df5ec90c61195421ba72223de35ccfb2f88"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f57a69461af2a5fa6e6bbd7a5f60d3b7e6cebb687f55106933188e79ad155c1"}, + {file = "pydantic_core-2.33.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:572c7e6c8bb4774d2ac88929e3d1f12bc45714ae5ee6d9a788a9fb35e60bb04b"}, + {file = "pydantic_core-2.33.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:db4b41f9bd95fbe5acd76d89920336ba96f03e149097365afe1cb092fceb89a1"}, + {file = "pydantic_core-2.33.2-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:fa854f5cf7e33842a892e5c73f45327760bc7bc516339fda888c75ae60edaeb6"}, + {file = "pydantic_core-2.33.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:5f483cfb75ff703095c59e365360cb73e00185e01aaea067cd19acffd2ab20ea"}, + {file = "pydantic_core-2.33.2-cp312-cp312-win32.whl", hash = "sha256:9cb1da0f5a471435a7bc7e439b8a728e8b61e59784b2af70d7c169f8dd8ae290"}, + {file = "pydantic_core-2.33.2-cp312-cp312-win_amd64.whl", hash = "sha256:f941635f2a3d96b2973e867144fde513665c87f13fe0e193c158ac51bfaaa7b2"}, + {file = "pydantic_core-2.33.2-cp312-cp312-win_arm64.whl", hash = "sha256:cca3868ddfaccfbc4bfb1d608e2ccaaebe0ae628e1416aeb9c4d88c001bb45ab"}, + {file = "pydantic_core-2.33.2-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:1082dd3e2d7109ad8b7da48e1d4710c8d06c253cbc4a27c1cff4fbcaa97a9e3f"}, + {file = "pydantic_core-2.33.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f517ca031dfc037a9c07e748cefd8d96235088b83b4f4ba8939105d20fa1dcd6"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0a9f2c9dd19656823cb8250b0724ee9c60a82f3cdf68a080979d13092a3b0fef"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2b0a451c263b01acebe51895bfb0e1cc842a5c666efe06cdf13846c7418caa9a"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ea40a64d23faa25e62a70ad163571c0b342b8bf66d5fa612ac0dec4f069d916"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0fb2d542b4d66f9470e8065c5469ec676978d625a8b7a363f07d9a501a9cb36a"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fdac5d6ffa1b5a83bca06ffe7583f5576555e6c8b3a91fbd25ea7780f825f7d"}, + {file = "pydantic_core-2.33.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:04a1a413977ab517154eebb2d326da71638271477d6ad87a769102f7c2488c56"}, + {file = "pydantic_core-2.33.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:c8e7af2f4e0194c22b5b37205bfb293d166a7344a5b0d0eaccebc376546d77d5"}, + {file = "pydantic_core-2.33.2-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:5c92edd15cd58b3c2d34873597a1e20f13094f59cf88068adb18947df5455b4e"}, + {file = "pydantic_core-2.33.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:65132b7b4a1c0beded5e057324b7e16e10910c106d43675d9bd87d4f38dde162"}, + {file = "pydantic_core-2.33.2-cp313-cp313-win32.whl", hash = "sha256:52fb90784e0a242bb96ec53f42196a17278855b0f31ac7c3cc6f5c1ec4811849"}, + {file = "pydantic_core-2.33.2-cp313-cp313-win_amd64.whl", hash = "sha256:c083a3bdd5a93dfe480f1125926afcdbf2917ae714bdb80b36d34318b2bec5d9"}, + {file = "pydantic_core-2.33.2-cp313-cp313-win_arm64.whl", hash = "sha256:e80b087132752f6b3d714f041ccf74403799d3b23a72722ea2e6ba2e892555b9"}, + {file = "pydantic_core-2.33.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:61c18fba8e5e9db3ab908620af374db0ac1baa69f0f32df4f61ae23f15e586ac"}, + {file = "pydantic_core-2.33.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95237e53bb015f67b63c91af7518a62a8660376a6a0db19b89acc77a4d6199f5"}, + {file = "pydantic_core-2.33.2-cp313-cp313t-win_amd64.whl", hash = "sha256:c2fc0a768ef76c15ab9238afa6da7f69895bb5d1ee83aeea2e3509af4472d0b9"}, + {file = "pydantic_core-2.33.2-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:a2b911a5b90e0374d03813674bf0a5fbbb7741570dcd4b4e85a2e48d17def29d"}, + {file = "pydantic_core-2.33.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6fa6dfc3e4d1f734a34710f391ae822e0a8eb8559a85c6979e14e65ee6ba2954"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c54c939ee22dc8e2d545da79fc5381f1c020d6d3141d3bd747eab59164dc89fb"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:53a57d2ed685940a504248187d5685e49eb5eef0f696853647bf37c418c538f7"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:09fb9dd6571aacd023fe6aaca316bd01cf60ab27240d7eb39ebd66a3a15293b4"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0e6116757f7959a712db11f3e9c0a99ade00a5bbedae83cb801985aa154f071b"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d55ab81c57b8ff8548c3e4947f119551253f4e3787a7bbc0b6b3ca47498a9d3"}, + {file = "pydantic_core-2.33.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c20c462aa4434b33a2661701b861604913f912254e441ab8d78d30485736115a"}, + {file = "pydantic_core-2.33.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:44857c3227d3fb5e753d5fe4a3420d6376fa594b07b621e220cd93703fe21782"}, + {file = "pydantic_core-2.33.2-cp39-cp39-musllinux_1_1_armv7l.whl", hash = "sha256:eb9b459ca4df0e5c87deb59d37377461a538852765293f9e6ee834f0435a93b9"}, + {file = "pydantic_core-2.33.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9fcd347d2cc5c23b06de6d3b7b8275be558a0c90549495c699e379a80bf8379e"}, + {file = "pydantic_core-2.33.2-cp39-cp39-win32.whl", hash = "sha256:83aa99b1285bc8f038941ddf598501a86f1536789740991d7d8756e34f1e74d9"}, + {file = "pydantic_core-2.33.2-cp39-cp39-win_amd64.whl", hash = "sha256:f481959862f57f29601ccced557cc2e817bce7533ab8e01a797a48b49c9692b3"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:5c4aa4e82353f65e548c476b37e64189783aa5384903bfea4f41580f255fddfa"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:d946c8bf0d5c24bf4fe333af284c59a19358aa3ec18cb3dc4370080da1e8ad29"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:87b31b6846e361ef83fedb187bb5b4372d0da3f7e28d85415efa92d6125d6e6d"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa9d91b338f2df0508606f7009fde642391425189bba6d8c653afd80fd6bb64e"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2058a32994f1fde4ca0480ab9d1e75a0e8c87c22b53a3ae66554f9af78f2fe8c"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:0e03262ab796d986f978f79c943fc5f620381be7287148b8010b4097f79a39ec"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:1a8695a8d00c73e50bff9dfda4d540b7dee29ff9b8053e38380426a85ef10052"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:fa754d1850735a0b0e03bcffd9d4b4343eb417e47196e4485d9cca326073a42c"}, + {file = "pydantic_core-2.33.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:a11c8d26a50bfab49002947d3d237abe4d9e4b5bdc8846a63537b6488e197808"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:dd14041875d09cc0f9308e37a6f8b65f5585cf2598a53aa0123df8b129d481f8"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:d87c561733f66531dced0da6e864f44ebf89a8fba55f31407b00c2f7f9449593"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2f82865531efd18d6e07a04a17331af02cb7a651583c418df8266f17a63c6612"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bfb5112df54209d820d7bf9317c7a6c9025ea52e49f46b6a2060104bba37de7"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:64632ff9d614e5eecfb495796ad51b0ed98c453e447a76bcbeeb69615079fc7e"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:f889f7a40498cc077332c7ab6b4608d296d852182211787d4f3ee377aaae66e8"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:de4b83bb311557e439b9e186f733f6c645b9417c84e2eb8203f3f820a4b988bf"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:82f68293f055f51b51ea42fafc74b6aad03e70e191799430b90c13d643059ebb"}, + {file = "pydantic_core-2.33.2-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:329467cecfb529c925cf2bbd4d60d2c509bc2fb52a20c1045bf09bb70971a9c1"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:87acbfcf8e90ca885206e98359d7dca4bcbb35abdc0ff66672a293e1d7a19101"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:7f92c15cd1e97d4b12acd1cc9004fa092578acfa57b67ad5e43a197175d01a64"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d3f26877a748dc4251cfcfda9dfb5f13fcb034f5308388066bcfe9031b63ae7d"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dac89aea9af8cd672fa7b510e7b8c33b0bba9a43186680550ccf23020f32d535"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:970919794d126ba8645f3837ab6046fb4e72bbc057b3709144066204c19a455d"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:3eb3fe62804e8f859c49ed20a8451342de53ed764150cb14ca71357c765dc2a6"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:3abcd9392a36025e3bd55f9bd38d908bd17962cc49bc6da8e7e96285336e2bca"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:3a1c81334778f9e3af2f8aeb7a960736e5cab1dfebfb26aabca09afd2906c039"}, + {file = "pydantic_core-2.33.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:2807668ba86cb38c6817ad9bc66215ab8584d1d304030ce4f0887336f28a5e27"}, + {file = "pydantic_core-2.33.2.tar.gz", hash = "sha256:7cb8bc3605c29176e1b105350d2e6474142d7c1bd1d9327c4a9bdb46bf827acc"}, +] + +[package.dependencies] +typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" + [[package]] name = "pygments" version = "2.18.0" @@ -1704,7 +1865,7 @@ files = [ ] [package.extras] -dev = ["Django (>=1.11)", "check-manifest", "colorama (<=0.4.1)", "coverage", "flake8", "nose2", "readme-renderer (<25.0)", "tox", "wheel", "zest.releaser[recommended]"] +dev = ["Django (>=1.11)", "check-manifest", "colorama (<=0.4.1) ; python_version == \"3.4\"", "coverage", "flake8", "nose2", "readme-renderer (<25.0) ; python_version == \"3.4\"", "tox", "wheel", "zest.releaser[recommended]"] doc = ["Sphinx", "sphinx-rtd-theme"] [[package]] @@ -1720,13 +1881,13 @@ files = [ ] [package.extras] -check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)", "ruff (>=0.8.0)"] -core = ["importlib_metadata (>=6)", "jaraco.functools (>=4)", "jaraco.text (>=3.7)", "more_itertools", "more_itertools (>=8.8)", "packaging (>=24.2)", "platformdirs (>=4.2.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\"", "ruff (>=0.8.0) ; sys_platform != \"cygwin\""] +core = ["importlib_metadata (>=6) ; python_version < \"3.10\"", "jaraco.functools (>=4)", "jaraco.text (>=3.7)", "more_itertools", "more_itertools (>=8.8)", "packaging (>=24.2)", "platformdirs (>=4.2.2)", "tomli (>=2.0.1) ; python_version < \"3.11\"", "wheel (>=0.43.0)"] cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier", "towncrier (<24.7)"] enabler = ["pytest-enabler (>=2.2)"] -test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.7.2)", "jaraco.test (>=5.5)", "packaging (>=24.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"] -type = ["importlib_metadata (>=7.0.2)", "jaraco.develop (>=7.21)", "mypy (==1.14.*)", "pytest-mypy"] +test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21) ; python_version >= \"3.9\" and sys_platform != \"cygwin\"", "jaraco.envs (>=2.2)", "jaraco.path (>=3.7.2)", "jaraco.test (>=5.5)", "packaging (>=24.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf ; sys_platform != \"cygwin\"", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"] +type = ["importlib_metadata (>=7.0.2) ; python_version < \"3.10\"", "jaraco.develop (>=7.21) ; sys_platform != \"cygwin\"", "mypy (==1.14.*)", "pytest-mypy"] [[package]] name = "six" @@ -1798,7 +1959,7 @@ sphinxcontrib-serializinghtml = ">=1.1.5" [package.extras] docs = ["sphinxcontrib-websupport"] lint = ["docutils-stubs", "flake8 (>=3.5.0)", "isort", "mypy (>=0.931)", "types-requests", "types-typed-ast"] -test = ["cython", "html5lib", "pytest", "pytest-cov", "typed-ast"] +test = ["cython", "html5lib", "pytest", "pytest-cov", "typed-ast ; python_version < \"3.8\""] [[package]] name = "sphinx-basic-ng" @@ -1961,12 +2122,26 @@ description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" groups = ["main"] -markers = "python_version < \"3.13\"" files = [ {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, ] +[[package]] +name = "typing-inspection" +version = "0.4.1" +description = "Runtime typing introspection tools" +optional = false +python-versions = ">=3.9" +groups = ["main"] +files = [ + {file = "typing_inspection-0.4.1-py3-none-any.whl", hash = "sha256:389055682238f53b04f7badcb49b989835495a96700ced5dab2d8feae4b26f51"}, + {file = "typing_inspection-0.4.1.tar.gz", hash = "sha256:6ae134cc0203c33377d43188d4064e9b357dba58cff3185f22924610e70a9d28"}, +] + +[package.dependencies] +typing-extensions = ">=4.12.0" + [[package]] name = "urllib3" version = "2.5.0" @@ -1980,7 +2155,7 @@ files = [ ] [package.extras] -brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +brotli = ["brotli (>=1.0.9) ; platform_python_implementation == \"CPython\"", "brotlicffi (>=0.8.0) ; platform_python_implementation != \"CPython\""] h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] @@ -2004,7 +2179,7 @@ platformdirs = ">=3.9.1,<5" [package.extras] docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] -test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8) ; platform_python_implementation == \"PyPy\" or platform_python_implementation == \"GraalVM\" or platform_python_implementation == \"CPython\" and sys_platform == \"win32\" and python_version >= \"3.13\"", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10) ; platform_python_implementation == \"CPython\""] [[package]] name = "yarl" @@ -2117,14 +2292,14 @@ files = [ ] [package.extras] -check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""] cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] enabler = ["pytest-enabler (>=2.2)"] -test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-ignore-flaky"] +test = ["big-O", "importlib-resources ; python_version < \"3.9\"", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-ignore-flaky"] type = ["pytest-mypy"] [metadata] lock-version = "2.1" python-versions = ">3.9.0,<3.9.1 || >3.9.1,<4.0" -content-hash = "e2a8515fbed1fa81249ae4c081412df1a60c5c5251c4b46400c14d25ee7bfc2c" +content-hash = "de156a072ba51879830a357a7ed43513654d673ae5b30269bd99ddc954823f7c" diff --git a/pyproject.toml b/pyproject.toml index 8a1ea44d..1f9b44a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "symphony_bdk_python" -version = "2.11.0" +version = "3.0.0-beta" license = "Apache-2.0" description = "Symphony Bot Development Kit for Python" readme = "README.md" @@ -23,6 +23,8 @@ cryptography = "^44.0.1" tenacity = "^8.0.1" defusedxml = "^0.7.1" docutils = "0.16" +pydantic = "^2.11.7" +aiohttp-retry = "^2.9.1" [tool.poetry.group.dev.dependencies] pytest = "^8.3.3" diff --git a/symphony/bdk/core/auth/ext_app_authenticator.py b/symphony/bdk/core/auth/ext_app_authenticator.py index 9d3966b2..32ac624e 100644 --- a/symphony/bdk/core/auth/ext_app_authenticator.py +++ b/symphony/bdk/core/auth/ext_app_authenticator.py @@ -131,7 +131,7 @@ async def _retrieve_tokens(self, app_token: str) -> ExtensionAppTokens: ) return await self._authentication_api.v1_pubkey_app_authenticate_extension_app_post( - authentication_request + authenticate_request=authentication_request ) @retry(retry=authentication_retry) diff --git a/symphony/bdk/core/client/api_client_factory.py b/symphony/bdk/core/client/api_client_factory.py index c5ad853a..e2b47bc6 100644 --- a/symphony/bdk/core/client/api_client_factory.py +++ b/symphony/bdk/core/client/api_client_factory.py @@ -128,9 +128,7 @@ def _get_api_client_with_client_cert( return ApiClientFactory._get_api_client_from_config(configuration, server_config) def _get_client_config(self, context, server_config): - configuration = Configuration( - host=(server_config.get_base_path() + context), discard_unknown_keys=True - ) + configuration = Configuration(host=(server_config.get_base_path() + context)) configuration.verify_ssl = True configuration.ssl_ca_cert = self._config.ssl.trust_store_path if server_config.proxy is not None: @@ -160,7 +158,7 @@ def _add_headers(client, server_config): if X_TRACE_ID.lower() not in ( header_name.lower() for header_name in default_headers.keys() ): - client._ApiClient__call_api = add_x_trace_id(client._ApiClient__call_api) + client.call_api = add_x_trace_id(client.call_api) @staticmethod def _configure_proxy(server_config, configuration): diff --git a/symphony/bdk/core/client/trace_id.py b/symphony/bdk/core/client/trace_id.py index 12f27d48..bcbc0c55 100644 --- a/symphony/bdk/core/client/trace_id.py +++ b/symphony/bdk/core/client/trace_id.py @@ -9,7 +9,7 @@ X_TRACE_ID = "X-Trace-Id" -HEADER_ARG_INDEX = 4 +HEADER_ARG_INDEX = 2 def setup_trace_id_log_record_factory(): diff --git a/symphony/bdk/core/service/application/application_service.py b/symphony/bdk/core/service/application/application_service.py index 7de60a3e..e61e1d72 100644 --- a/symphony/bdk/core/service/application/application_service.py +++ b/symphony/bdk/core/service/application/application_service.py @@ -1,3 +1,5 @@ +from typing import List + from symphony.bdk.core.auth.auth_session import AuthSession from symphony.bdk.core.config.model.bdk_retry_config import BdkRetryConfig from symphony.bdk.core.retry import retry @@ -5,11 +7,8 @@ from symphony.bdk.gen.pod_api.application_api import ApplicationApi from symphony.bdk.gen.pod_model.application_detail import ApplicationDetail from symphony.bdk.gen.pod_model.pod_app_entitlement import PodAppEntitlement -from symphony.bdk.gen.pod_model.pod_app_entitlement_list import PodAppEntitlementList from symphony.bdk.gen.pod_model.user_app_entitlement import UserAppEntitlement -from symphony.bdk.gen.pod_model.user_app_entitlement_list import UserAppEntitlementList from symphony.bdk.gen.pod_model.user_app_entitlement_patch import UserAppEntitlementPatch -from symphony.bdk.gen.pod_model.user_app_entitlements_patch_list import UserAppEntitlementsPatchList class ApplicationService: @@ -115,7 +114,7 @@ async def get_application(self, app_id: str) -> ApplicationDetail: return await self._application_api.v1_admin_app_id_get_get(**params) @retry - async def list_application_entitlements(self) -> [PodAppEntitlement]: + async def list_application_entitlements(self) -> List[PodAppEntitlement]: """ Get the list of application entitlements for the company. @@ -128,12 +127,12 @@ async def list_application_entitlements(self) -> [PodAppEntitlement]: pod_app_entitlement_list = ( await self._app_entitlement_api.v1_admin_app_entitlement_list_get(**params) ) - return pod_app_entitlement_list.value + return pod_app_entitlement_list @retry async def update_application_entitlements( - self, entitlements: [PodAppEntitlement] - ) -> [PodAppEntitlement]: + self, entitlements: List[PodAppEntitlement] + ) -> List[PodAppEntitlement]: """ Update the list of application entitlements for the company. @@ -145,16 +144,16 @@ async def update_application_entitlements( """ params = { - "payload": PodAppEntitlementList(value=entitlements), + "payload": entitlements, "session_token": await self._auth_session.session_token, } pod_app_entitlement_list = ( await self._app_entitlement_api.v1_admin_app_entitlement_list_post(**params) ) - return pod_app_entitlement_list.value + return pod_app_entitlement_list @retry - async def list_user_applications(self, user_id: int) -> [UserAppEntitlement]: + async def list_user_applications(self, user_id: int) -> List[UserAppEntitlement]: """ Get the list of Symphony application entitlements for a particular user. @@ -169,11 +168,11 @@ async def list_user_applications(self, user_id: int) -> [UserAppEntitlement]: user_app_entitlement_list = ( await self._app_entitlement_api.v1_admin_user_uid_app_entitlement_list_get(**params) ) - return user_app_entitlement_list.value + return user_app_entitlement_list @retry async def update_user_applications( - self, user_id: int, user_app_entitlements: [UserAppEntitlement] + self, user_id: int, user_app_entitlements: List[UserAppEntitlement] ): """ Update the application entitlements for a particular user. @@ -188,17 +187,17 @@ async def update_user_applications( """ params = { "uid": user_id, - "payload": UserAppEntitlementList(value=user_app_entitlements), + "payload": user_app_entitlements, "session_token": await self._auth_session.session_token, } user_app_entitlement_list = ( await self._app_entitlement_api.v1_admin_user_uid_app_entitlement_list_post(**params) ) - return user_app_entitlement_list.value + return user_app_entitlement_list @retry async def patch_user_applications( - self, user_id: int, user_app_entitlements: [UserAppEntitlementPatch] + self, user_id: int, user_app_entitlements: List[UserAppEntitlementPatch] ): """ Updates particular app entitlements for a particular user. Supports partial update. @@ -213,10 +212,10 @@ async def patch_user_applications( """ params = { "uid": user_id, - "payload": UserAppEntitlementsPatchList(value=user_app_entitlements), + "payload": user_app_entitlements, "session_token": await self._auth_session.session_token, } user_app_entitlements_list = ( await self._app_entitlement_api.v1_admin_user_uid_app_entitlement_list_patch(**params) ) - return user_app_entitlements_list.value + return user_app_entitlements_list diff --git a/symphony/bdk/core/service/connection/connection_service.py b/symphony/bdk/core/service/connection/connection_service.py index 71f0a413..2b8fc2d2 100644 --- a/symphony/bdk/core/service/connection/connection_service.py +++ b/symphony/bdk/core/service/connection/connection_service.py @@ -1,3 +1,5 @@ +from typing import List + from symphony.bdk.core.auth.auth_session import AuthSession from symphony.bdk.core.config.model.bdk_retry_config import BdkRetryConfig from symphony.bdk.core.retry import retry @@ -42,8 +44,8 @@ async def get_connection(self, user_id: int) -> UserConnection: @retry async def list_connections( - self, status: ConnectionStatus = ConnectionStatus.ALL, user_ids: [int] = None - ) -> [UserConnection]: + self, status: ConnectionStatus = ConnectionStatus.ALL, user_ids: List[int] = None + ) -> List[UserConnection]: """ List all connection statuses of the requesting user with external or specified users. See: `List Connections `_ @@ -64,7 +66,7 @@ async def list_connections( params["user_ids"] = ",".join(map(str, user_ids)) user_connection_list = await self._connection_api.v1_connection_list_get(**params) - return user_connection_list.value + return user_connection_list @retry async def create_connection(self, user_id: int) -> UserConnection: diff --git a/symphony/bdk/core/service/datafeed/abstract_ackId_event_loop.py b/symphony/bdk/core/service/datafeed/abstract_ackId_event_loop.py index 449f6b99..b0ef94b1 100644 --- a/symphony/bdk/core/service/datafeed/abstract_ackId_event_loop.py +++ b/symphony/bdk/core/service/datafeed/abstract_ackId_event_loop.py @@ -1,6 +1,7 @@ import logging import time from abc import ABC, abstractmethod +from typing import Union from symphony.bdk.core.auth.auth_session import AuthSession from symphony.bdk.core.config.model.bdk_config import BdkConfig @@ -8,6 +9,7 @@ from symphony.bdk.core.service.datafeed.exception import EventError from symphony.bdk.core.service.session.session_service import SessionService from symphony.bdk.gen.agent_api.datafeed_api import DatafeedApi +from symphony.bdk.gen.agent_api.datahose_api import DatahoseApi EVENT_PROCESSING_MAX_DURATION_SECONDS = 30 @@ -19,14 +21,14 @@ class AbstractAckIdEventLoop(AbstractDatafeedLoop, ABC): def __init__( self, - datafeed_api: DatafeedApi, + datafeed_api: Union[DatafeedApi, DatahoseApi], session_service: SessionService, auth_session: AuthSession, config: BdkConfig, ): """ - :param datafeed_api: DatafeedApi to request the service + :param datafeed_api: DatafeedApi or DatahoseApi to request the service :param session_service: the SessionService to get user session information :param auth_session: the AuthSession instance used to get session and key manager tokens :param config: the bot configuration diff --git a/symphony/bdk/core/service/datafeed/abstract_datafeed_loop.py b/symphony/bdk/core/service/datafeed/abstract_datafeed_loop.py index 6fc9d1eb..aa9d0d9c 100644 --- a/symphony/bdk/core/service/datafeed/abstract_datafeed_loop.py +++ b/symphony/bdk/core/service/datafeed/abstract_datafeed_loop.py @@ -6,13 +6,14 @@ from asyncio import Task from contextvars import ContextVar from enum import Enum -from typing import List +from typing import List, Union from symphony.bdk.core.auth.auth_session import AuthSession from symphony.bdk.core.config.model.bdk_config import BdkConfig from symphony.bdk.core.service.datafeed.real_time_event_listener import RealTimeEventListener from symphony.bdk.core.service.session.session_service import SessionService from symphony.bdk.gen.agent_api.datafeed_api import DatafeedApi +from symphony.bdk.gen.agent_api.datahose_api import DatahoseApi from symphony.bdk.gen.agent_model.v4_event import V4Event logger = logging.getLogger(__name__) @@ -72,14 +73,14 @@ class AbstractDatafeedLoop(ABC): def __init__( self, - datafeed_api: DatafeedApi, + datafeed_api: Union[DatafeedApi, DatahoseApi], session_service: SessionService, auth_session: AuthSession, config: BdkConfig, ): """ - :param datafeed_api: DatafeedApi to request the service + :param datafeed_api: DatafeedApi or DatahoseApi to request the service :param session_service: the SessionService to get user session information :param auth_session: the AuthSession instance used to get session and key manager tokens :param config: the bot configuration diff --git a/symphony/bdk/core/service/datafeed/datafeed_loop_v1.py b/symphony/bdk/core/service/datafeed/datafeed_loop_v1.py index 129c9a0a..8db0c7c1 100644 --- a/symphony/bdk/core/service/datafeed/datafeed_loop_v1.py +++ b/symphony/bdk/core/service/datafeed/datafeed_loop_v1.py @@ -81,7 +81,7 @@ async def _read_datafeed(self): events = await self._datafeed_api.v4_datafeed_id_read_get( id=self._datafeed_id, session_token=session_token, key_manager_token=key_manager_token ) - return events.value if events is not None and events.value else [] + return events if events is not None else [] async def _log_listener_exception(self, task): exception = task.exception() diff --git a/symphony/bdk/core/service/datafeed/datahose_loop.py b/symphony/bdk/core/service/datafeed/datahose_loop.py index 37501a6a..d98b64b9 100644 --- a/symphony/bdk/core/service/datafeed/datahose_loop.py +++ b/symphony/bdk/core/service/datafeed/datahose_loop.py @@ -7,7 +7,7 @@ from symphony.bdk.core.service.datafeed.abstract_ackId_event_loop import AbstractAckIdEventLoop from symphony.bdk.core.service.datafeed.abstract_datahose_loop import AbstractDatahoseLoop from symphony.bdk.core.service.session.session_service import SessionService -from symphony.bdk.gen.agent_api.datafeed_api import DatafeedApi +from symphony.bdk.gen.agent_api.datahose_api import DatahoseApi from symphony.bdk.gen.agent_model.v5_events_read_body import V5EventsReadBody # DFv2 API authorizes a maximum length for the tag parameter @@ -30,12 +30,12 @@ class DatahoseLoop(AbstractAckIdEventLoop, AbstractDatahoseLoop): def __init__( self, - datafeed_api: DatafeedApi, + datahose_api: DatahoseApi, session_service: SessionService, auth_session: AuthSession, config: BdkConfig, ): - super().__init__(datafeed_api, session_service, auth_session, config) + super().__init__(datahose_api, session_service, auth_session, config) if config.datahose is not None: not_truncated_tag = ( config.datahose.tag diff --git a/symphony/bdk/core/service/message/message_parser.py b/symphony/bdk/core/service/message/message_parser.py index c51e0f75..60dcc56c 100644 --- a/symphony/bdk/core/service/message/message_parser.py +++ b/symphony/bdk/core/service/message/message_parser.py @@ -7,7 +7,7 @@ import json from enum import Enum from json import JSONDecodeError -from typing import Dict +from typing import Dict, List from defusedxml.ElementTree import ParseError, fromstring, tostring @@ -30,7 +30,7 @@ def get_text_content_from_message(message: V4Message) -> str: ) from exc -def get_mentions(message: V4Message) -> [int]: +def get_mentions(message: V4Message) -> List[int]: """Parse data inside an incoming message and returns a list containing the user ids corresponding to the users mentioned @@ -41,7 +41,7 @@ def get_mentions(message: V4Message) -> [int]: return [int(user_id) for user_id in mentions_list] -def get_hashtags(message: V4Message) -> [str]: +def get_hashtags(message: V4Message) -> List[str]: """Parse data inside an incoming message and returns a list containing the text of the hashtags found :param message: message incoming V4 message to be parsed @@ -50,7 +50,7 @@ def get_hashtags(message: V4Message) -> [str]: return _get_tags(message, _EntityTypeEnum.HASHTAG) -def get_cashtags(message: V4Message) -> [str]: +def get_cashtags(message: V4Message) -> List[str]: """Parse data inside an incoming message and returns a list containing the text of the cashtags found :param message: message incoming V4 message to be parsed diff --git a/symphony/bdk/core/service/message/message_service.py b/symphony/bdk/core/service/message/message_service.py index 9b8eb447..4b13f7bb 100644 --- a/symphony/bdk/core/service/message/message_service.py +++ b/symphony/bdk/core/service/message/message_service.py @@ -16,7 +16,6 @@ from symphony.bdk.gen.agent_model.v4_message_blast_response import ( V4MessageBlastResponse, ) -from symphony.bdk.gen.agent_model.v4_message_import_list import V4MessageImportList from symphony.bdk.gen.pod_api.default_api import DefaultApi from symphony.bdk.gen.pod_api.message_api import MessageApi from symphony.bdk.gen.pod_api.message_suppression_api import MessageSuppressionApi @@ -201,7 +200,7 @@ async def get_attachment_types(self) -> List[str]: """ params = {"session_token": await self._auth_session.session_token} type_list = await self._pod_api.v1_files_allowed_types_get(**params) - return type_list.value + return type_list async def blast_message( self, @@ -307,8 +306,8 @@ def __init__( @retry async def list_messages( self, stream_id: str, since: int = 0, skip: int = 0, limit: int = 50 - ) -> [V4Message]: - """Get messages from an existing stream. Additionally returns any attachments associated with the message. + ) -> List[V4Message]: + """Get messages from an existing stream. Additionally, returns any attachments associated with the message. See: `Messages `_ :param stream_id: The stream where to look for messages @@ -328,10 +327,10 @@ async def list_messages( "limit": limit, } message_list = await self._messages_api.v4_stream_sid_message_get(**params) - return message_list.value + return message_list @retry - async def import_messages(self, messages: List[V4ImportedMessage]) -> [V4ImportResponse]: + async def import_messages(self, messages: List[V4ImportedMessage]) -> List[V4ImportResponse]: """Imports a list of messages to Symphony. See: `Import Message `_ @@ -341,12 +340,12 @@ async def import_messages(self, messages: List[V4ImportedMessage]) -> [V4ImportR """ params = { - "message_list": V4MessageImportList(value=messages), + "message_list": messages, "session_token": await self._auth_session.session_token, "key_manager_token": await self._auth_session.key_manager_token, } import_response_list = await self._messages_api.v4_message_import_post(**params) - return import_response_list.value + return import_response_list async def get_attachment(self, stream_id: str, message_id: str, attachment_id: str) -> str: """Downloads the attachment body by the stream ID, message ID and attachment ID. @@ -434,7 +433,7 @@ async def list_attachments( if to is not None: params["to"] = to attachment_list = await self._streams_api.v1_streams_sid_attachments_get(**params) - return attachment_list.value + return attachment_list @retry async def list_message_receipts(self, message_id: str) -> MessageReceiptDetailResponse: @@ -501,7 +500,7 @@ async def search_messages( "limit": limit, } message_list = await self._messages_api.v1_message_search_post(**params) - return message_list.value # endpoint returns empty list when no values found + return message_list async def search_all_messages( self, diff --git a/symphony/bdk/core/service/message/multi_attachments_messages_api.py b/symphony/bdk/core/service/message/multi_attachments_messages_api.py index 6a27f29c..5d242778 100644 --- a/symphony/bdk/core/service/message/multi_attachments_messages_api.py +++ b/symphony/bdk/core/service/message/multi_attachments_messages_api.py @@ -1,8 +1,15 @@ +import io +import mimetypes +import os +from typing import Any, Dict, List, Optional, Tuple, Union + +from pydantic import ConfigDict, Field, StrictFloat, StrictInt, StrictStr, validate_call +from typing_extensions import Annotated + from symphony.bdk.gen.agent_api.messages_api import MessagesApi from symphony.bdk.gen.agent_model.v4_message import V4Message from symphony.bdk.gen.agent_model.v4_message_blast_response import V4MessageBlastResponse -from symphony.bdk.gen.api_client import Endpoint -from symphony.bdk.gen.model_utils import file_type +from symphony.bdk.gen.api_client import RequestSerialized class MultiAttachmentsMessagesApi(MessagesApi): @@ -10,274 +17,288 @@ class MultiAttachmentsMessagesApi(MessagesApi): which allows to send or blast a message with multiple attachments and previews """ - def __init__(self, api_client=None): - super().__init__(api_client) - - self.v4_multi_attachment_message_blast_post_endpoint = Endpoint( - settings={ - "response_type": (V4MessageBlastResponse,), - "auth": [], - "endpoint_path": "/v4/message/blast", - "operation_id": "v4_message_blast_post", - "http_method": "POST", - "servers": None, - }, - params_map={ - "all": [ - "session_token", - "sids", - "key_manager_token", - "message", - "data", - "version", - "attachment", - "preview", - ], - "required": [ - "session_token", - "sids", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "session_token": (str,), - "sids": ([str],), - "key_manager_token": (str,), - "message": (str,), - "data": (str,), - "version": (str,), - "attachment": ([file_type],), - "preview": ([file_type],), - }, - "attribute_map": { - "session_token": "sessionToken", - "sids": "sids", - "key_manager_token": "keyManagerToken", - "message": "message", - "data": "data", - "version": "version", - "attachment": "attachment", - "preview": "preview", - }, - "location_map": { - "session_token": "header", - "sids": "form", - "key_manager_token": "header", - "message": "form", - "data": "form", - "version": "form", - "attachment": "form", - "preview": "form", - }, - "collection_format_map": { - "sids": "csv", - }, - }, - headers_map={"accept": ["application/json"], "content_type": ["multipart/form-data"]}, - api_client=api_client, - ) - self.v4_stream_sid_multi_attachment_message_create_post_endpoint = Endpoint( - settings={ - "response_type": (V4Message,), - "auth": [], - "endpoint_path": "/v4/stream/{sid}/message/create", - "operation_id": "v4_stream_sid_message_create_post", - "http_method": "POST", - "servers": None, - }, - params_map={ - "all": [ - "sid", - "session_token", - "key_manager_token", - "message", - "data", - "version", - "attachment", - "preview", - ], - "required": [ - "sid", - "session_token", - ], - "nullable": [], - "enum": [], - "validation": [], - }, - root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "sid": (str,), - "session_token": (str,), - "key_manager_token": (str,), - "message": (str,), - "data": (str,), - "version": (str,), - "attachment": ([file_type],), - "preview": ([file_type],), - }, - "attribute_map": { - "sid": "sid", - "session_token": "sessionToken", - "key_manager_token": "keyManagerToken", - "message": "message", - "data": "data", - "version": "version", - "attachment": "attachment", - "preview": "preview", - }, - "location_map": { - "sid": "path", - "session_token": "header", - "key_manager_token": "header", - "message": "form", - "data": "form", - "version": "form", - "attachment": "form", - "preview": "form", - }, - "collection_format_map": {}, - }, - headers_map={"accept": ["application/json"], "content_type": ["multipart/form-data"]}, - api_client=api_client, + @validate_call(config=ConfigDict(arbitrary_types_allowed=True)) + async def v4_stream_sid_multi_attachment_message_create_post( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[ + StrictStr, Field(description="Authorization token used to make delegated calls.") + ], + key_manager_token: Annotated[ + Optional[StrictStr], Field(description="Key Manager authentication token.") + ] = None, + message: Annotated[ + Optional[StrictStr], Field(description="The message payload in MessageML.") + ] = None, + data: Annotated[ + Optional[StrictStr], Field(description="Optional message data in EntityJSON.") + ] = None, + version: Annotated[ + Optional[StrictStr], + Field( + description='Optional message version in the format "major.minor". If empty, defaults to the latest supported version. ' + ), + ] = None, + attachment: Annotated[ + Optional[List[io.IOBase]], Field(description="Optional file attachment.") + ] = None, + preview: Annotated[ + Optional[List[io.IOBase]], Field(description="Optional attachment preview.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V4Message: + """Post a message to one existing stream.""" + _param = self._v4_stream_sid_multi_attachment_message_create_post_serialize( + sid=sid, + session_token=session_token, + key_manager_token=key_manager_token, + message=message, + data=data, + version=version, + attachment=attachment, + preview=preview, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, ) - def v4_stream_sid_multi_attachment_message_create_post(self, sid, session_token, **kwargs): - """Post a message to one existing stream. # noqa: E501 + _response_types_map: Dict[str, Optional[str]] = { + "200": "V4Message", + "400": "Error", + "401": "Error", + "403": "Error", + "500": "Error", + } + response_data = await self.api_client.call_api(*_param, _request_timeout=_request_timeout) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + def _v4_stream_sid_multi_attachment_message_create_post_serialize( + self, + sid, + session_token, + key_manager_token, + message, + data, + version, + attachment, + preview, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + _collection_formats: Dict[str, str] = {} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None - >>> thread = agent_api.v4_stream_sid_message_create_post(sid, session_token, async_req=True) - >>> result = thread.get() + if sid is not None: + _path_params["sid"] = sid + if session_token is not None: + _header_params["sessionToken"] = session_token + if key_manager_token is not None: + _header_params["keyManagerToken"] = key_manager_token + if message is not None: + _form_params.append(("message", message)) + if data is not None: + _form_params.append(("data", data)) + if version is not None: + _form_params.append(("version", version)) + if attachment: + for att_file in attachment: + filename = os.path.basename(att_file.name) + filedata = att_file.read() + mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream" + _form_params.append(("attachment", (filename, filedata, mimetype))) + if preview: + for prev_file in preview: + filename = os.path.basename(prev_file.name) + filedata = prev_file.read() + mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream" + _form_params.append(("preview", (filename, filedata, mimetype))) - Args: - sid (str): Stream ID - session_token (str): Authorization token used to make delegated calls. + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - message (str): The message payload in MessageML.. [optional] - data (str): Optional message data in EntityJSON.. [optional] - version (str): Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. . [optional] - attachment (file_type): Optional file attachment.. [optional] - preview (file_type): Optional attachment preview.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V4Message - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["sid"] = sid - kwargs["session_token"] = session_token - return self.v4_stream_sid_multi_attachment_message_create_post_endpoint.call_with_http_info( - **kwargs + return self.api_client.param_serialize( + method="POST", + resource_path="/v4/stream/{sid}/message/create", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=[], + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, ) - def v4_multi_attachment_message_blast_post(self, session_token, sids, **kwargs): - """Post a message to multiple existing streams. # noqa: E501 + @validate_call(config=ConfigDict(arbitrary_types_allowed=True)) + async def v4_multi_attachment_message_blast_post( + self, + session_token: Annotated[ + StrictStr, Field(description="Authorization token used to make delegated calls.") + ], + sids: Annotated[List[StrictStr], Field(description="A comma-separated list of Stream IDs")], + key_manager_token: Annotated[ + Optional[StrictStr], Field(description="Key Manager authentication token.") + ] = None, + message: Annotated[ + Optional[StrictStr], Field(description="The message payload in MessageML.") + ] = None, + data: Annotated[ + Optional[StrictStr], Field(description="Optional message data in EntityJSON.") + ] = None, + version: Annotated[ + Optional[StrictStr], + Field( + description='Optional message version in the format "major.minor". If empty, defaults to the latest supported version. ' + ), + ] = None, + attachment: Annotated[ + Optional[List[io.IOBase]], Field(description="Optional file attachment.") + ] = None, + preview: Annotated[ + Optional[List[io.IOBase]], Field(description="Optional attachment preview.") + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V4MessageBlastResponse: + """Post a message to multiple existing streams.""" + _param = self._v4_multi_attachment_message_blast_post_serialize( + session_token=session_token, + sids=sids, + key_manager_token=key_manager_token, + message=message, + data=data, + version=version, + attachment=attachment, + preview=preview, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) - Post a new message to the given list of streams. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. If the message is in MessageML and fails schema validation a client error results This endpoint is idempotent, it means that a 200 response will be returned even if the message has not been delivered to some streams. Check the `errors` map from the response in order to see on which stream(s) the message has not been delivered. The maximum number of streams where the message can be sent is limitted to 100. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True + _response_types_map: Dict[str, Optional[str]] = { + "200": "V4MessageBlastResponse", + "400": "Error", + "401": "Error", + "403": "Error", + "500": "Error", + } + response_data = await self.api_client.call_api(*_param, _request_timeout=_request_timeout) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - >>> thread = agent_api.v4_message_blast_post(session_token, sids, async_req=True) - >>> result = thread.get() + def _v4_multi_attachment_message_blast_post_serialize( + self, + session_token, + sids, + key_manager_token, + message, + data, + version, + attachment, + preview, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + _host = None + _collection_formats: Dict[str, str] = {"sids": "csv"} + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None - Args: - session_token (str): Authorization token used to make delegated calls. - sids ([str]): A comma-separated list of Stream IDs + if session_token is not None: + _header_params["sessionToken"] = session_token + if key_manager_token is not None: + _header_params["keyManagerToken"] = key_manager_token + if sids is not None: + _form_params.append(("sids", sids)) + if message is not None: + _form_params.append(("message", message)) + if data is not None: + _form_params.append(("data", data)) + if version is not None: + _form_params.append(("version", version)) + if attachment: + for att_file in attachment: + filename = os.path.basename(att_file.name) + filedata = att_file.read() + mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream" + _form_params.append(("attachment", (filename, filedata, mimetype))) + if preview: + for prev_file in preview: + filename = os.path.basename(prev_file.name) + filedata = prev_file.read() + mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream" + _form_params.append(("preview", (filename, filedata, mimetype))) - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - message (str): The message payload in MessageML.. [optional] - data (str): Optional message data in EntityJSON.. [optional] - version (str): Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. . [optional] - attachment (file_type): Optional file attachment.. [optional] - preview (file_type): Optional attachment preview.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["multipart/form-data"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type - Returns: - V4MessageBlastResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs["async_req"] = kwargs.get("async_req", False) - kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) - kwargs["_preload_content"] = kwargs.get("_preload_content", True) - kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) - kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) - kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) - kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) - kwargs["_content_type"] = kwargs.get("_content_type") - kwargs["_host_index"] = kwargs.get("_host_index") - kwargs["session_token"] = session_token - kwargs["sids"] = sids - return self.v4_multi_attachment_message_blast_post_endpoint.call_with_http_info(**kwargs) + return self.api_client.param_serialize( + method="POST", + resource_path="/v4/message/blast", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=[], + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/symphony/bdk/core/service/presence/presence_service.py b/symphony/bdk/core/service/presence/presence_service.py index 2f12c5ad..7f50aa09 100644 --- a/symphony/bdk/core/service/presence/presence_service.py +++ b/symphony/bdk/core/service/presence/presence_service.py @@ -70,7 +70,7 @@ async def get_all_presence(self, last_user_id: int, limit: int) -> List[V2Presen last_user_id=last_user_id, limit=limit, ) - return presence_list.value + return presence_list @retry async def get_user_presence(self, user_id: int, local: bool) -> V2Presence: @@ -146,7 +146,7 @@ async def read_presence_feed(self, feed_id: str) -> List[V2Presence]: presence_list = await self._presence_api.v1_presence_feed_feed_id_read_get( session_token=await self._auth_session.session_token, feed_id=feed_id ) - return presence_list.value + return presence_list @retry async def delete_presence_feed(self, feed_id: str) -> str: diff --git a/symphony/bdk/core/service/signal/signal_service.py b/symphony/bdk/core/service/signal/signal_service.py index 6ea62eac..897a7b37 100644 --- a/symphony/bdk/core/service/signal/signal_service.py +++ b/symphony/bdk/core/service/signal/signal_service.py @@ -1,4 +1,4 @@ -from typing import AsyncGenerator +from typing import AsyncGenerator, List from symphony.bdk.core.auth.auth_session import AuthSession from symphony.bdk.core.config.model.bdk_retry_config import BdkRetryConfig @@ -10,7 +10,6 @@ from symphony.bdk.gen.agent_model.channel_subscriber_response import ChannelSubscriberResponse from symphony.bdk.gen.agent_model.channel_subscription_response import ChannelSubscriptionResponse from symphony.bdk.gen.agent_model.signal import Signal -from symphony.bdk.gen.agent_model.signal_list import SignalList class OboSignalService: @@ -35,7 +34,7 @@ def __init__( self._retry_config = retry_config @retry - async def list_signals(self, skip: int = 0, limit: int = 50) -> SignalList: + async def list_signals(self, skip: int = 0, limit: int = 50) -> List[Signal]: """Lists signals on behalf of the user. The response includes signals that the user has created and public signals to which they have subscribed. @@ -68,7 +67,7 @@ async def list_all_signals( async def list_signals_one_page(skip, limit): result = await self.list_signals(skip, limit) - return result.value if result else None + return result if result else None return offset_based_pagination(list_signals_one_page, chunk_size, max_number) diff --git a/symphony/bdk/core/service/stream/stream_service.py b/symphony/bdk/core/service/stream/stream_service.py index d0935527..ba9dcbb4 100644 --- a/symphony/bdk/core/service/stream/stream_service.py +++ b/symphony/bdk/core/service/stream/stream_service.py @@ -1,4 +1,4 @@ -from typing import AsyncGenerator +from typing import AsyncGenerator, List from symphony.bdk.core.auth.auth_session import AuthSession from symphony.bdk.core.config.model.bdk_retry_config import BdkRetryConfig @@ -9,14 +9,12 @@ from symphony.bdk.gen.agent_model.v2_message import V2Message from symphony.bdk.gen.pod_api.room_membership_api import RoomMembershipApi from symphony.bdk.gen.pod_api.streams_api import StreamsApi -from symphony.bdk.gen.pod_model.membership_list import MembershipList +from symphony.bdk.gen.pod_model.member_info import MemberInfo from symphony.bdk.gen.pod_model.room_detail import RoomDetail from symphony.bdk.gen.pod_model.stream import Stream from symphony.bdk.gen.pod_model.stream_attributes import StreamAttributes from symphony.bdk.gen.pod_model.stream_filter import StreamFilter -from symphony.bdk.gen.pod_model.stream_list import StreamList from symphony.bdk.gen.pod_model.user_id import UserId -from symphony.bdk.gen.pod_model.user_id_list import UserIdList from symphony.bdk.gen.pod_model.v1_im_attributes import V1IMAttributes from symphony.bdk.gen.pod_model.v1_im_detail import V1IMDetail from symphony.bdk.gen.pod_model.v2_admin_stream_filter import V2AdminStreamFilter @@ -66,7 +64,7 @@ async def create_im(self, user_id: int) -> Stream: :return: the created stream. """ return await self._streams_api.v1_im_create_post( - uid_list=UserIdList(value=[user_id]), + uid_list=[user_id], session_token=await self._auth_session.session_token, ) @@ -111,7 +109,7 @@ async def get_room_info(self, room_id: str) -> V3RoomDetail: @retry async def list_streams( self, stream_filter: StreamFilter, skip: int = 0, limit: int = 50 - ) -> StreamList: + ) -> List[StreamAttributes]: """Returns a list of all the streams of which the requesting user is a member, sorted by creation date (ascending - oldest to newest). Wraps the `List User Streams `_ endpoint. @@ -144,7 +142,7 @@ async def list_all_streams( async def list_streams_one_page(skip, limit): result = await self.list_streams(stream_filter, skip, limit) - return result.value if result else None + return result if result else None return offset_based_pagination(list_streams_one_page, chunk_size, max_number) @@ -336,7 +334,7 @@ async def update_im(self, im_id: str, im_attributes: V1IMAttributes) -> V1IMDeta ) @retry - async def create_im_admin(self, user_ids: [int]) -> Stream: + async def create_im_admin(self, user_ids: List[int]) -> Stream: """Create a new single or multi party instant message conversation. At least two user IDs must be provided or an error response will be sent. The caller is not included in the members of the created chat. @@ -352,7 +350,7 @@ async def create_im_admin(self, user_ids: [int]) -> Stream: :return: the created IM or MIM. """ return await self._streams_api.v1_admin_im_create_post( - uid_list=UserIdList(value=user_ids), + uid_list=user_ids, session_token=await self._auth_session.session_token, ) @@ -405,7 +403,7 @@ async def list_all_streams_admin( async def list_streams_admin_one_page(skip, limit): result = await self.list_streams_admin(stream_filter, skip, limit) - return result.streams.value if result.streams else None + return result.streams if result.streams else None return offset_based_pagination(list_streams_admin_one_page, chunk_size, max_number) @@ -416,7 +414,7 @@ async def list_user_streams_admin( stream_filter: StreamFilter = None, skip: int = 0, limit: int = 50, - ) -> StreamList: + ) -> List[StreamAttributes]: """Retrieve a list of all streams of which a user is a member. Wraps the `User Streams `_ endpoint. @@ -453,7 +451,7 @@ async def list_all_user_streams_admin( async def list_streams_one_page(skip, limit): result = await self.list_user_streams_admin(uid, stream_filter, skip, limit) - return result.value if result else None + return result if result else None return offset_based_pagination(list_streams_one_page, chunk_size, max_number) @@ -490,12 +488,12 @@ async def list_all_stream_members( async def list_stream_members_one_page(skip, limit): members = await self.list_stream_members(stream_id, skip, limit) - return members.members.value if members.members else None + return members.members if members.members else None return offset_based_pagination(list_stream_members_one_page, chunk_size, max_number) @retry - async def list_room_members(self, room_id: str) -> MembershipList: + async def list_room_members(self, room_id: str) -> List[MemberInfo]: """Lists the current members of an existing room. Wraps the `Room Members `_ endpoint. diff --git a/symphony/bdk/core/service/user/user_service.py b/symphony/bdk/core/service/user/user_service.py index 2f45aed3..74b6b736 100644 --- a/symphony/bdk/core/service/user/user_service.py +++ b/symphony/bdk/core/service/user/user_service.py @@ -1,7 +1,7 @@ import base64 import json from pathlib import Path -from typing import AsyncGenerator, Union +from typing import AsyncGenerator, List, Union from symphony.bdk.core.auth.auth_session import AuthSession from symphony.bdk.core.config.model.bdk_retry_config import BdkRetryConfig @@ -19,15 +19,14 @@ from symphony.bdk.gen.pod_model.delegate_action import DelegateAction from symphony.bdk.gen.pod_model.disclaimer import Disclaimer from symphony.bdk.gen.pod_model.feature import Feature -from symphony.bdk.gen.pod_model.feature_list import FeatureList from symphony.bdk.gen.pod_model.followers_list import FollowersList from symphony.bdk.gen.pod_model.followers_list_response import FollowersListResponse from symphony.bdk.gen.pod_model.following_list_response import FollowingListResponse from symphony.bdk.gen.pod_model.role_detail import RoleDetail from symphony.bdk.gen.pod_model.service_account_manifest import ServiceAccountManifest from symphony.bdk.gen.pod_model.string_id import StringId +from symphony.bdk.gen.pod_model.user_detail import UserDetail from symphony.bdk.gen.pod_model.user_filter import UserFilter -from symphony.bdk.gen.pod_model.user_id_list import UserIdList from symphony.bdk.gen.pod_model.user_search_query import UserSearchQuery from symphony.bdk.gen.pod_model.user_search_results import UserSearchResults from symphony.bdk.gen.pod_model.user_status import UserStatus @@ -63,7 +62,7 @@ def __init__( @retry async def list_users_by_ids( - self, user_ids: [int], local: bool = False, active: bool = None + self, user_ids: List[int], local: bool = False, active: bool = None ) -> V2UserList: """Search users by user ids. See : `Users Lookup v3 `_ @@ -90,7 +89,7 @@ async def list_users_by_ids( @retry async def list_users_by_emails( - self, emails: [str], local: bool = False, active: bool = None + self, emails: List[str], local: bool = False, active: bool = None ) -> V2UserList: """Search users by emails. See : `Users Lookup v3 `_ @@ -116,7 +115,9 @@ async def list_users_by_emails( return await self._users_api.v3_users_get(**params) @retry - async def list_users_by_usernames(self, usernames: [str], active: bool = None) -> V2UserList: + async def list_users_by_usernames( + self, usernames: List[str], active: bool = None + ) -> V2UserList: """Search users by usernames. See : `Users Lookup v3 `_ @@ -194,7 +195,7 @@ async def search_users_one_page(skip: int, limit: int): return offset_based_pagination(search_users_one_page, chunk_size, max_number) @retry - async def follow_user(self, follower_ids: [int], user_id: int) -> None: + async def follow_user(self, follower_ids: List[int], user_id: int) -> None: """Make a list of users to start following a specific user. See: `Follow User `_ @@ -203,13 +204,13 @@ async def follow_user(self, follower_ids: [int], user_id: int) -> None: """ params = { "uid": user_id, - "uid_list": FollowersList(followers=UserIdList(value=follower_ids)), + "uid_list": FollowersList(followers=follower_ids), "session_token": await self._auth_session.session_token, } await self._user_api.v1_user_uid_follow_post(**params) @retry - async def unfollow_user(self, follower_ids: [int], user_id: int) -> None: + async def unfollow_user(self, follower_ids: List[int], user_id: int) -> None: """Make a list of users to stop following a specific user. See: `Unfollow User `_ @@ -218,7 +219,7 @@ async def unfollow_user(self, follower_ids: [int], user_id: int) -> None: """ params = { "uid": user_id, - "uid_list": FollowersList(followers=UserIdList(value=follower_ids)), + "uid_list": FollowersList(followers=follower_ids), "session_token": await self._auth_session.session_token, } await self._user_api.v1_user_uid_unfollow_post(**params) @@ -258,14 +259,14 @@ async def get_user_detail(self, user_id: int) -> V2UserDetail: """Retrieve user details of a particular user. See: 'Get User v2 '_ - :param user_id: User Id + :param user_id: User id :return: Details of the user. """ params = {"uid": user_id, "session_token": await self._auth_session.session_token} return await self._user_api.v2_admin_user_uid_get(**params) @retry - async def list_user_details(self, skip: int = 0, limit: int = 50) -> [V2UserDetail]: + async def list_user_details(self, skip: int = 0, limit: int = 50) -> List[V2UserDetail]: """Retrieve all users in the company (pod). See: 'List Users V2 '_ @@ -279,7 +280,7 @@ async def list_user_details(self, skip: int = 0, limit: int = 50) -> [V2UserDeta "limit": limit, } user_detail_list = await self._user_api.v2_admin_user_list_get(**params) - return user_detail_list.value + return user_detail_list async def list_all_user_details( self, chunk_size: int = 50, max_number: int = None @@ -299,7 +300,7 @@ async def list_all_user_details( @retry async def list_user_details_by_filter( self, user_filter: UserFilter, skip: int = 0, limit: int = 50 - ) -> [V2UserDetail]: + ) -> List[UserDetail]: """Retrieve a list of users in the company (pod) by a filter. See: `Find Users V1 `_ @@ -315,13 +316,13 @@ async def list_user_details_by_filter( "limit": limit, } user_detail_list = await self._user_api.v1_admin_user_find_post(**params) - return user_detail_list.value + return user_detail_list async def list_all_user_details_by_filter( self, user_filter: UserFilter, chunk_size: int = 50, max_number: int = None ) -> AsyncGenerator[V2UserDetail, None]: """Retrieve an asynchronous generator of users in the company (pod) by a filter. - Same as :func:`~list_user_details_by_filter` but returns an generator which performs the paginated + Same as :func:`~list_user_details_by_filter` but returns a generator which performs the paginated calls with the correct skip and limit values. See: `Find Users V1 `_ @@ -353,15 +354,15 @@ async def add_role(self, user_id: int, role_id: RoleId) -> None: await self._user_api.v1_admin_user_uid_roles_add_post(**params) @retry - async def list_roles(self) -> [RoleDetail]: + async def list_roles(self) -> List[RoleDetail]: """List all roles in the pod. See: `List Roles `_ :return: List of all roles details in the pod. """ params = {"session_token": await self._auth_session.session_token} - role_list = await self._system_api.v1_admin_system_roles_list_get(**params) - return role_list.value + role_list = await self._user_api.v1_admin_system_roles_list_get(**params) + return role_list @retry async def remove_role(self, user_id: int, role_id: RoleId) -> None: @@ -379,7 +380,7 @@ async def remove_role(self, user_id: int, role_id: RoleId) -> None: await self._user_api.v1_admin_user_uid_roles_remove_post(**params) @retry - async def get_avatar(self, user_id: int) -> [Avatar]: + async def get_avatar(self, user_id: int) -> List[Avatar]: """Get the url of avatar of a user. See: `User Avatar `_ @@ -388,7 +389,7 @@ async def get_avatar(self, user_id: int) -> [Avatar]: """ params = {"uid": user_id, "session_token": await self._auth_session.session_token} avatar_list = await self._user_api.v1_admin_user_uid_avatar_get(**params) - return avatar_list.value + return avatar_list @retry async def update_avatar(self, user_id: int, image: Union[str, bytes]) -> None: @@ -445,7 +446,7 @@ async def add_disclaimer(self, user_id: int, disclaimer_id: str) -> None: await self._user_api.v1_admin_user_uid_disclaimer_update_post(**params) @retry - async def get_delegates(self, user_id: int) -> [int]: + async def get_delegates(self, user_id: int) -> List[int]: """Get delegates assigned to a user. See: `User Delegates `_ @@ -454,7 +455,7 @@ async def get_delegates(self, user_id: int) -> [int]: """ params = {"uid": user_id, "session_token": await self._auth_session.session_token} delegates_list = await self._user_api.v1_admin_user_uid_delegates_get(**params) - return delegates_list.value + return delegates_list @retry async def update_delegates( @@ -464,7 +465,7 @@ async def update_delegates( See: `Update User Delegates `_ :param user_id: User id. - :param delegate_user_id: Delegated user Id to be assigned + :param delegate_user_id: Delegated user id to be assigned :param action: Action to be performed """ params = { @@ -475,7 +476,7 @@ async def update_delegates( await self._user_api.v1_admin_user_uid_delegates_update_post(**params) @retry - async def get_feature_entitlements(self, user_id: int) -> [Feature]: + async def get_feature_entitlements(self, user_id: int) -> List[Feature]: """Get feature entitlements of a user. See: `User Features `_ @@ -484,10 +485,10 @@ async def get_feature_entitlements(self, user_id: int) -> [Feature]: """ params = {"uid": user_id, "session_token": await self._auth_session.session_token} feature_list = await self._user_api.v1_admin_user_uid_features_get(**params) - return feature_list.value + return feature_list @retry - async def update_feature_entitlements(self, user_id: int, features: [Feature]) -> None: + async def update_feature_entitlements(self, user_id: int, features: List[Feature]) -> None: """Update feature entitlements of a user. See: `Update User Features `_ @@ -496,7 +497,7 @@ async def update_feature_entitlements(self, user_id: int, features: [Feature]) - """ params = { "uid": user_id, - "payload": FeatureList(value=features), + "payload": features, "session_token": await self._auth_session.session_token, } await self._user_api.v1_admin_user_uid_features_update_post(**params) @@ -629,7 +630,7 @@ async def update(self, user_id: int, payload: V2UserAttributes) -> V2UserDetail: """Updates an existing user. See: `Update User v2 `_ - :param user_id: User Id + :param user_id: User id :param payload: User's new attributes for update. :return: User with the updated user details. """ @@ -782,7 +783,7 @@ async def update_manifest_from_json(self, manifest_data: str) -> None: """ await self._user_api.v1_user_manifest_own_post( session_token=await self._auth_session.session_token, - manifest=ServiceAccountManifest(manifest_data), + manifest=ServiceAccountManifest(manifest=manifest_data), ) async def update_manifest_from_file(self) -> None: @@ -801,7 +802,7 @@ async def update_manifest_from_file(self) -> None: await self._user_api.v1_user_manifest_own_post( session_token=await self._auth_session.session_token, - manifest=ServiceAccountManifest(manifest_text), + manifest=ServiceAccountManifest(manifest=manifest_text), ) @retry diff --git a/symphony/bdk/core/service_factory.py b/symphony/bdk/core/service_factory.py index 6db14197..e682d23f 100644 --- a/symphony/bdk/core/service_factory.py +++ b/symphony/bdk/core/service_factory.py @@ -30,6 +30,7 @@ from symphony.bdk.gen.agent_api.attachments_api import AttachmentsApi from symphony.bdk.gen.agent_api.audit_trail_api import AuditTrailApi from symphony.bdk.gen.agent_api.datafeed_api import DatafeedApi +from symphony.bdk.gen.agent_api.datahose_api import DatahoseApi from symphony.bdk.gen.agent_api.share_api import ShareApi from symphony.bdk.gen.agent_api.signals_api import SignalsApi from symphony.bdk.gen.agent_api.system_api import SystemApi as AgentSystemApi @@ -175,7 +176,7 @@ def get_datahose_loop(self) -> AbstractDatahoseLoop: """ if self._config.datahose is not None: return DatahoseLoop( - DatafeedApi(self._agent_client), + DatahoseApi(self._agent_client), self._session_service, self._auth_session, self._config, diff --git a/symphony/bdk/ext/group.py b/symphony/bdk/ext/group.py index 1a7e9664..1890c07a 100644 --- a/symphony/bdk/ext/group.py +++ b/symphony/bdk/ext/group.py @@ -22,6 +22,8 @@ from symphony.bdk.gen.group_model.upload_avatar import UploadAvatar from symphony.bdk.gen.login_api.authentication_api import AuthenticationApi +X_SYMPHONY_HOST = "localhost" + async def refresh_bearer_token_if_unauthorized(retry_state): """Function used by the retry decorator to refresh the bearer token if conditions apply @@ -86,7 +88,9 @@ async def insert_group(self, create_group: CreateGroup) -> ReadGroup: :param create_group: the details of the group to be created :return: the created group """ - return await self._group_api.insert_group(x_symphony_host="", create_group=create_group) + return await self._group_api.insert_group( + x_symphony_host=X_SYMPHONY_HOST, create_group=create_group + ) @retry(retry=refresh_bearer_token_if_unauthorized) async def list_groups( @@ -108,7 +112,7 @@ async def list_groups( :param sort_order: sorting direction of items (ordered by creation date) :return: the list of matching groups """ - kwargs = dict(x_symphony_host="", type_id="SDL") + kwargs = dict(x_symphony_host=X_SYMPHONY_HOST, type_id="SDL") if status is not None: kwargs["status"] = status if before is not None: @@ -153,7 +157,10 @@ async def update_group( :return: the updated group """ return await self._group_api.update_group( - x_symphony_host="", if_match=if_match, group_id=group_id, update_group=update_group + x_symphony_host=X_SYMPHONY_HOST, + if_match=if_match, + group_id=group_id, + update_group=update_group, ) @retry(retry=refresh_bearer_token_if_unauthorized) @@ -168,7 +175,7 @@ async def update_avatar(self, group_id: str, image: str) -> ReadGroup: """ upload_avatar = UploadAvatar(image=image) return await self._group_api.update_avatar( - x_symphony_host="", group_id=group_id, upload_avatar=upload_avatar + x_symphony_host=X_SYMPHONY_HOST, group_id=group_id, upload_avatar=upload_avatar ) @retry(retry=refresh_bearer_token_if_unauthorized) @@ -179,7 +186,7 @@ async def get_group(self, group_id: str) -> ReadGroup: :param group_id: the ID of the group to retrieve :return: the group details """ - return await self._group_api.get_group(x_symphony_host="", group_id=group_id) + return await self._group_api.get_group(x_symphony_host=X_SYMPHONY_HOST, group_id=group_id) @retry(retry=refresh_bearer_token_if_unauthorized) async def add_member_to_group(self, group_id: str, user_id: int) -> ReadGroup: @@ -192,7 +199,7 @@ async def add_member_to_group(self, group_id: str, user_id: int) -> ReadGroup: """ member = Member(member_id=user_id, member_tenant=extract_tenant_id(user_id)) return await self._group_api.add_member_to_group( - x_symphony_host="", group_id=group_id, add_member=AddMember(member=member) + x_symphony_host=X_SYMPHONY_HOST, group_id=group_id, add_member=AddMember(member=member) ) @@ -209,7 +216,7 @@ def __init__(self, login_client, session, retry_config): async def refresh(self): """Refreshes internal Bearer authentication token from the bot sessionToken.""" jwt_token = await self._authentication_api.idm_tokens_post( - await self._auth_session.session_token, scope="profile-manager" + session_token=await self._auth_session.session_token, scope="profile-manager" ) self._bearer_token = jwt_token.access_token diff --git a/symphony/bdk/gen/__init__.py b/symphony/bdk/gen/__init__.py index baf84e11..b3367d6d 100644 --- a/symphony/bdk/gen/__init__.py +++ b/symphony/bdk/gen/__init__.py @@ -9,7 +9,6 @@ Generated by: https://openapi-generator.tech """ - __version__ = "1.0.0" # import ApiClient @@ -17,11 +16,4 @@ # import Configuration from symphony.bdk.gen.configuration import Configuration - -# import exceptions -from symphony.bdk.gen.exceptions import OpenApiException -from symphony.bdk.gen.exceptions import ApiAttributeError -from symphony.bdk.gen.exceptions import ApiTypeError -from symphony.bdk.gen.exceptions import ApiValueError -from symphony.bdk.gen.exceptions import ApiKeyError -from symphony.bdk.gen.exceptions import ApiException +from symphony.bdk.gen.rest import ApiException \ No newline at end of file diff --git a/symphony/bdk/gen/agent_api/__init__.py b/symphony/bdk/gen/agent_api/__init__.py deleted file mode 100644 index 74c41b15..00000000 --- a/symphony/bdk/gen/agent_api/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# do not import all apis into this module because that uses a lot of memory and stack frames diff --git a/symphony/bdk/gen/agent_api/attachments_api.py b/symphony/bdk/gen/agent_api/attachments_api.py index a12ebea1..2bb66bab 100644 --- a/symphony/bdk/gen/agent_api/attachments_api.py +++ b/symphony/bdk/gen/agent_api/attachments_api.py @@ -1,512 +1,1047 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) +from pydantic import Field, StrictBytes, StrictStr +from typing import Optional, Tuple, Union +from typing_extensions import Annotated from symphony.bdk.gen.agent_model.attachment_info import AttachmentInfo -from symphony.bdk.gen.agent_model.error import Error +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class AttachmentsApi(object): + +class AttachmentsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_stream_sid_attachment_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (AttachmentInfo,), - 'auth': [], - 'endpoint_path': '/v1/stream/{sid}/attachment/create', - 'operation_id': 'v1_stream_sid_attachment_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'session_token', - 'file', - 'key_manager_token', - ], - 'required': [ - 'sid', - 'session_token', - 'file', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'session_token': - (str,), - 'file': - (file_type,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'session_token': 'sessionToken', - 'file': 'file', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'sid': 'path', - 'session_token': 'header', - 'file': 'form', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'multipart/form-data' - ] - }, - api_client=api_client + + + @validate_call + async def v1_stream_sid_attachment_create_post( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The attachment body.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AttachmentInfo: + """(Deprecated) Upload an attachment. + + Upload an attachment to the given stream. The stream can be a chatroom, an IM or a multiparty IM. Once uploaded, you can use this attachment on a message you send in that stream. If the attachment is uploaded then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param file: The attachment body. (required) + :type file: bytearray + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/stream/{sid}/attachment/create is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_attachment_create_post_serialize( + sid=sid, + session_token=session_token, + file=file, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - self.v1_stream_sid_attachment_get_endpoint = _Endpoint( - settings={ - 'response_type': (str,), - 'auth': [], - 'endpoint_path': '/v1/stream/{sid}/attachment', - 'operation_id': 'v1_stream_sid_attachment_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'file_id', - 'message_id', - 'session_token', - 'key_manager_token', - ], - 'required': [ - 'sid', - 'file_id', - 'message_id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'file_id': - (str,), - 'message_id': - (str,), - 'session_token': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'file_id': 'fileId', - 'message_id': 'messageId', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'sid': 'path', - 'file_id': 'query', - 'message_id': 'query', - 'session_token': 'header', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/octet-stream' - ], - 'content_type': [], - }, - api_client=api_client + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AttachmentInfo", + '400': "Error", + '401': "Error", + '403': "Error", + '422': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - self.v3_stream_sid_attachment_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (AttachmentInfo,), - 'auth': [], - 'endpoint_path': '/v3/stream/{sid}/attachment/create', - 'operation_id': 'v3_stream_sid_attachment_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'session_token', - 'file', - 'key_manager_token', - ], - 'required': [ - 'sid', - 'session_token', - 'file', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'session_token': - (str,), - 'file': - (file_type,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'session_token': 'sessionToken', - 'file': 'file', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'sid': 'path', - 'session_token': 'header', - 'file': 'form', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'multipart/form-data' - ] - }, - api_client=api_client + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_stream_sid_attachment_create_post_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The attachment body.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AttachmentInfo]: + """(Deprecated) Upload an attachment. + + Upload an attachment to the given stream. The stream can be a chatroom, an IM or a multiparty IM. Once uploaded, you can use this attachment on a message you send in that stream. If the attachment is uploaded then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param file: The attachment body. (required) + :type file: bytearray + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/stream/{sid}/attachment/create is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_attachment_create_post_serialize( + sid=sid, + session_token=session_token, + file=file, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - def v1_stream_sid_attachment_create_post( + _response_types_map: Dict[str, Optional[str]] = { + '200': "AttachmentInfo", + '400': "Error", + '401': "Error", + '403': "Error", + '422': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_stream_sid_attachment_create_post_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The attachment body.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Upload an attachment. + + Upload an attachment to the given stream. The stream can be a chatroom, an IM or a multiparty IM. Once uploaded, you can use this attachment on a message you send in that stream. If the attachment is uploaded then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param file: The attachment body. (required) + :type file: bytearray + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/stream/{sid}/attachment/create is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_attachment_create_post_serialize( + sid=sid, + session_token=session_token, + file=file, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AttachmentInfo", + '400': "Error", + '401': "Error", + '403': "Error", + '422': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_stream_sid_attachment_create_post_serialize( self, sid, session_token, file, - **kwargs - ): - """Upload an attachment. # noqa: E501 - - Upload an attachment to the given stream. The stream can be a chatroom, an IM or a multiparty IM. Once uploaded, you can use this attachment on a message you send in that stream. If the attachment is uploaded then 200 is returned. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_stream_sid_attachment_create_post(sid, session_token, file, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - session_token (str): Session authentication token. - file (file_type): The attachment body. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - AttachmentInfo - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + if file is not None: + _files['file'] = file + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/stream/{sid}/attachment/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def v1_stream_sid_attachment_get( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + file_id: Annotated[StrictStr, Field(description="The attachment ID (Base64-encoded)")], + message_id: Annotated[StrictStr, Field(description="The ID of the message containing the attachment")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytearray: + """Download an attachment. + + Downloads the attachment body by the attachment ID, stream ID, and message ID. + + :param sid: Stream ID (required) + :type sid: str + :param file_id: The attachment ID (Base64-encoded) (required) + :type file_id: str + :param message_id: The ID of the message containing the attachment (required) + :type message_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_stream_sid_attachment_get_serialize( + sid=sid, + file_id=file_id, + message_id=message_id, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_stream_sid_attachment_get_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + file_id: Annotated[StrictStr, Field(description="The attachment ID (Base64-encoded)")], + message_id: Annotated[StrictStr, Field(description="The ID of the message containing the attachment")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytearray]: + """Download an attachment. + + Downloads the attachment body by the attachment ID, stream ID, and message ID. + + :param sid: Stream ID (required) + :type sid: str + :param file_id: The attachment ID (Base64-encoded) (required) + :type file_id: str + :param message_id: The ID of the message containing the attachment (required) + :type message_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_stream_sid_attachment_get_serialize( + sid=sid, + file_id=file_id, + message_id=message_id, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_stream_sid_attachment_get_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + file_id: Annotated[StrictStr, Field(description="The attachment ID (Base64-encoded)")], + message_id: Annotated[StrictStr, Field(description="The ID of the message containing the attachment")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Download an attachment. + + Downloads the attachment body by the attachment ID, stream ID, and message ID. + + :param sid: Stream ID (required) + :type sid: str + :param file_id: The attachment ID (Base64-encoded) (required) + :type file_id: str + :param message_id: The ID of the message containing the attachment (required) + :type message_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_stream_sid_attachment_get_serialize( + sid=sid, + file_id=file_id, + message_id=message_id, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['session_token'] = \ - session_token - kwargs['file'] = \ - file - return self.v1_stream_sid_attachment_create_post_endpoint.call_with_http_info(**kwargs) - - def v1_stream_sid_attachment_get( + return response_data.response + + + def _v1_stream_sid_attachment_get_serialize( self, sid, file_id, message_id, session_token, - **kwargs - ): - """Download an attachment. # noqa: E501 - - Downloads the attachment body by the attachment ID, stream ID, and message ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_stream_sid_attachment_get(sid, file_id, message_id, session_token, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - file_id (str): The attachment ID (Base64-encoded) - message_id (str): The ID of the message containing the attachment - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - str - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + if file_id is not None: + + _query_params.append(('fileId', file_id)) + + if message_id is not None: + + _query_params.append(('messageId', message_id)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/octet-stream' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/stream/{sid}/attachment', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def v3_stream_sid_attachment_create_post( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The attachment body.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AttachmentInfo: + """(Deprecated) PROVISIONAL - Upload an attachment. + + Upload an attachment to the given stream. The stream can be a chatroom, an IM or a multiparty IM. Once uploaded, you can use this attachment on a message you send in that stream. If the attachment is uploaded then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param file: The attachment body. (required) + :type file: bytearray + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v3/stream/{sid}/attachment/create is deprecated.", DeprecationWarning) + + _param = self._v3_stream_sid_attachment_create_post_serialize( + sid=sid, + session_token=session_token, + file=file, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AttachmentInfo", + '400': "Error", + '401': "Error", + '403': "Error", + '422': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_stream_sid_attachment_create_post_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The attachment body.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AttachmentInfo]: + """(Deprecated) PROVISIONAL - Upload an attachment. + + Upload an attachment to the given stream. The stream can be a chatroom, an IM or a multiparty IM. Once uploaded, you can use this attachment on a message you send in that stream. If the attachment is uploaded then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param file: The attachment body. (required) + :type file: bytearray + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v3/stream/{sid}/attachment/create is deprecated.", DeprecationWarning) + + _param = self._v3_stream_sid_attachment_create_post_serialize( + sid=sid, + session_token=session_token, + file=file, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AttachmentInfo", + '400': "Error", + '401': "Error", + '403': "Error", + '422': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v3_stream_sid_attachment_create_post_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The attachment body.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) PROVISIONAL - Upload an attachment. + + Upload an attachment to the given stream. The stream can be a chatroom, an IM or a multiparty IM. Once uploaded, you can use this attachment on a message you send in that stream. If the attachment is uploaded then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param file: The attachment body. (required) + :type file: bytearray + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v3/stream/{sid}/attachment/create is deprecated.", DeprecationWarning) + + _param = self._v3_stream_sid_attachment_create_post_serialize( + sid=sid, + session_token=session_token, + file=file, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AttachmentInfo", + '400': "Error", + '401': "Error", + '403': "Error", + '422': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['file_id'] = \ - file_id - kwargs['message_id'] = \ - message_id - kwargs['session_token'] = \ - session_token - return self.v1_stream_sid_attachment_get_endpoint.call_with_http_info(**kwargs) - - def v3_stream_sid_attachment_create_post( + return response_data.response + + + def _v3_stream_sid_attachment_create_post_serialize( self, sid, session_token, file, - **kwargs - ): - """PROVISIONAL - Upload an attachment. # noqa: E501 - - Upload an attachment to the given stream. The stream can be a chatroom, an IM or a multiparty IM. Once uploaded, you can use this attachment on a message you send in that stream. If the attachment is uploaded then 200 is returned. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_stream_sid_attachment_create_post(sid, session_token, file, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - session_token (str): Session authentication token. - file (file_type): The attachment body. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - AttachmentInfo - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + if file is not None: + _files['file'] = file + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/stream/{sid}/attachment/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['session_token'] = \ - session_token - kwargs['file'] = \ - file - return self.v3_stream_sid_attachment_create_post_endpoint.call_with_http_info(**kwargs) + diff --git a/symphony/bdk/gen/agent_api/audit_trail_api.py b/symphony/bdk/gen/agent_api/audit_trail_api.py index fe59f443..9a27a353 100644 --- a/symphony/bdk/gen/agent_api/audit_trail_api.py +++ b/symphony/bdk/gen/agent_api/audit_trail_api.py @@ -1,218 +1,448 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.agent_model.error import Error +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated from symphony.bdk.gen.agent_model.v1_audit_trail_initiator_list import V1AuditTrailInitiatorList +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class AuditTrailApi(object): +class AuditTrailApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_audittrail_privilegeduser_get_endpoint = _Endpoint( - settings={ - 'response_type': (V1AuditTrailInitiatorList,), - 'auth': [], - 'endpoint_path': '/v1/audittrail/privilegeduser', - 'operation_id': 'v1_audittrail_privilegeduser_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'start_timestamp', - 'key_manager_token', - 'end_timestamp', - 'before', - 'after', - 'limit', - 'initiator_id', - 'role', - ], - 'required': [ - 'session_token', - 'start_timestamp', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'start_timestamp': - (int,), - 'key_manager_token': - (str,), - 'end_timestamp': - (int,), - 'before': - (str,), - 'after': - (str,), - 'limit': - (int,), - 'initiator_id': - (int,), - 'role': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'start_timestamp': 'startTimestamp', - 'key_manager_token': 'keyManagerToken', - 'end_timestamp': 'endTimestamp', - 'before': 'before', - 'after': 'after', - 'limit': 'limit', - 'initiator_id': 'initiatorId', - 'role': 'role', - }, - 'location_map': { - 'session_token': 'header', - 'start_timestamp': 'query', - 'key_manager_token': 'header', - 'end_timestamp': 'query', - 'before': 'query', - 'after': 'query', - 'limit': 'query', - 'initiator_id': 'query', - 'role': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - def v1_audittrail_privilegeduser_get( + + @validate_call + async def v1_audittrail_privilegeduser_get( self, - session_token, - start_timestamp, - **kwargs - ): - """Get a list of actions performed by a privileged account acting as privileged user given a period of time. # noqa: E501 - - Get a list of actions performed by a privileged account acting as privileged user given a period of time. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_audittrail_privilegeduser_get(session_token, start_timestamp, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - start_timestamp (int): Start timestamp in unix timestamp in millseconds. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - end_timestamp (int): End timestamp in unix timestamp in millseconds. If not specified, it assumes to be current time.. [optional] - before (str): Return results from an opaque “before” cursor value as presented via a response cursor.. [optional] - after (str): Return results from an opaque “after” cursor value as presented via a response cursor.. [optional] - limit (int): Max No. of violations to return. If no value is provided, 50 is the default. Some maximums for limit may be enforced for performance reasons. The maximum supported value is 500. . [optional] - initiator_id (int): If present, only the initiator with this initiator will be returned.. [optional] - role (str): If present, only the audit trail initiated by s user with privileged role acting as privileged user will be returned. Privileged eliglible roles: User Provisioning (USER_PROVISIONING), Content Management (CONTENT_MANAGEMENT), Expression Filter Policy Management (EF_POLICY_MANAGEMENT), SCO (SUPER_COMPLIANCE_OFFICER), CO (COMPLIANCE_OFFICER), Super admin (SUPER_ADMINISTRATOR), Admin (ADMINISTRATOR), L1 (L1_SUPPORT), L2 (L2_SUPPORT), Scope Manager (SCOPE_MANAGEMENT) . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1AuditTrailInitiatorList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + start_timestamp: Annotated[StrictInt, Field(description="Start timestamp in unix timestamp in millseconds.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + end_timestamp: Annotated[Optional[StrictInt], Field(description="End timestamp in unix timestamp in millseconds. If not specified, it assumes to be current time.")] = None, + before: Annotated[Optional[StrictStr], Field(description="Return results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Return results from an opaque “after” cursor value as presented via a response cursor.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. Some maximums for limit may be enforced for performance reasons. The maximum supported value is 500. ")] = None, + initiator_id: Annotated[Optional[StrictInt], Field(description="If present, only the initiator with this initiator will be returned.")] = None, + role: Annotated[Optional[StrictStr], Field(description="If present, only the audit trail initiated by s user with privileged role acting as privileged user will be returned. Privileged eliglible roles: User Provisioning (USER_PROVISIONING), Content Management (CONTENT_MANAGEMENT), Expression Filter Policy Management (EF_POLICY_MANAGEMENT), SCO (SUPER_COMPLIANCE_OFFICER), CO (COMPLIANCE_OFFICER), Super admin (SUPER_ADMINISTRATOR), Admin (ADMINISTRATOR), L1 (L1_SUPPORT), L2 (L2_SUPPORT), Scope Manager (SCOPE_MANAGEMENT) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1AuditTrailInitiatorList: + """Get a list of actions performed by a privileged account acting as privileged user given a period of time. + + Get a list of actions performed by a privileged account acting as privileged user given a period of time. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param start_timestamp: Start timestamp in unix timestamp in millseconds. (required) + :type start_timestamp: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param end_timestamp: End timestamp in unix timestamp in millseconds. If not specified, it assumes to be current time. + :type end_timestamp: int + :param before: Return results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Return results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. Some maximums for limit may be enforced for performance reasons. The maximum supported value is 500. + :type limit: int + :param initiator_id: If present, only the initiator with this initiator will be returned. + :type initiator_id: int + :param role: If present, only the audit trail initiated by s user with privileged role acting as privileged user will be returned. Privileged eliglible roles: User Provisioning (USER_PROVISIONING), Content Management (CONTENT_MANAGEMENT), Expression Filter Policy Management (EF_POLICY_MANAGEMENT), SCO (SUPER_COMPLIANCE_OFFICER), CO (COMPLIANCE_OFFICER), Super admin (SUPER_ADMINISTRATOR), Admin (ADMINISTRATOR), L1 (L1_SUPPORT), L2 (L2_SUPPORT), Scope Manager (SCOPE_MANAGEMENT) + :type role: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_audittrail_privilegeduser_get_serialize( + session_token=session_token, + start_timestamp=start_timestamp, + key_manager_token=key_manager_token, + end_timestamp=end_timestamp, + before=before, + after=after, + limit=limit, + initiator_id=initiator_id, + role=role, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1AuditTrailInitiatorList", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_audittrail_privilegeduser_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + start_timestamp: Annotated[StrictInt, Field(description="Start timestamp in unix timestamp in millseconds.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + end_timestamp: Annotated[Optional[StrictInt], Field(description="End timestamp in unix timestamp in millseconds. If not specified, it assumes to be current time.")] = None, + before: Annotated[Optional[StrictStr], Field(description="Return results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Return results from an opaque “after” cursor value as presented via a response cursor.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. Some maximums for limit may be enforced for performance reasons. The maximum supported value is 500. ")] = None, + initiator_id: Annotated[Optional[StrictInt], Field(description="If present, only the initiator with this initiator will be returned.")] = None, + role: Annotated[Optional[StrictStr], Field(description="If present, only the audit trail initiated by s user with privileged role acting as privileged user will be returned. Privileged eliglible roles: User Provisioning (USER_PROVISIONING), Content Management (CONTENT_MANAGEMENT), Expression Filter Policy Management (EF_POLICY_MANAGEMENT), SCO (SUPER_COMPLIANCE_OFFICER), CO (COMPLIANCE_OFFICER), Super admin (SUPER_ADMINISTRATOR), Admin (ADMINISTRATOR), L1 (L1_SUPPORT), L2 (L2_SUPPORT), Scope Manager (SCOPE_MANAGEMENT) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1AuditTrailInitiatorList]: + """Get a list of actions performed by a privileged account acting as privileged user given a period of time. + + Get a list of actions performed by a privileged account acting as privileged user given a period of time. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param start_timestamp: Start timestamp in unix timestamp in millseconds. (required) + :type start_timestamp: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param end_timestamp: End timestamp in unix timestamp in millseconds. If not specified, it assumes to be current time. + :type end_timestamp: int + :param before: Return results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Return results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. Some maximums for limit may be enforced for performance reasons. The maximum supported value is 500. + :type limit: int + :param initiator_id: If present, only the initiator with this initiator will be returned. + :type initiator_id: int + :param role: If present, only the audit trail initiated by s user with privileged role acting as privileged user will be returned. Privileged eliglible roles: User Provisioning (USER_PROVISIONING), Content Management (CONTENT_MANAGEMENT), Expression Filter Policy Management (EF_POLICY_MANAGEMENT), SCO (SUPER_COMPLIANCE_OFFICER), CO (COMPLIANCE_OFFICER), Super admin (SUPER_ADMINISTRATOR), Admin (ADMINISTRATOR), L1 (L1_SUPPORT), L2 (L2_SUPPORT), Scope Manager (SCOPE_MANAGEMENT) + :type role: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_audittrail_privilegeduser_get_serialize( + session_token=session_token, + start_timestamp=start_timestamp, + key_manager_token=key_manager_token, + end_timestamp=end_timestamp, + before=before, + after=after, + limit=limit, + initiator_id=initiator_id, + role=role, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1AuditTrailInitiatorList", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_audittrail_privilegeduser_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + start_timestamp: Annotated[StrictInt, Field(description="Start timestamp in unix timestamp in millseconds.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + end_timestamp: Annotated[Optional[StrictInt], Field(description="End timestamp in unix timestamp in millseconds. If not specified, it assumes to be current time.")] = None, + before: Annotated[Optional[StrictStr], Field(description="Return results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Return results from an opaque “after” cursor value as presented via a response cursor.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. Some maximums for limit may be enforced for performance reasons. The maximum supported value is 500. ")] = None, + initiator_id: Annotated[Optional[StrictInt], Field(description="If present, only the initiator with this initiator will be returned.")] = None, + role: Annotated[Optional[StrictStr], Field(description="If present, only the audit trail initiated by s user with privileged role acting as privileged user will be returned. Privileged eliglible roles: User Provisioning (USER_PROVISIONING), Content Management (CONTENT_MANAGEMENT), Expression Filter Policy Management (EF_POLICY_MANAGEMENT), SCO (SUPER_COMPLIANCE_OFFICER), CO (COMPLIANCE_OFFICER), Super admin (SUPER_ADMINISTRATOR), Admin (ADMINISTRATOR), L1 (L1_SUPPORT), L2 (L2_SUPPORT), Scope Manager (SCOPE_MANAGEMENT) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a list of actions performed by a privileged account acting as privileged user given a period of time. + + Get a list of actions performed by a privileged account acting as privileged user given a period of time. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param start_timestamp: Start timestamp in unix timestamp in millseconds. (required) + :type start_timestamp: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param end_timestamp: End timestamp in unix timestamp in millseconds. If not specified, it assumes to be current time. + :type end_timestamp: int + :param before: Return results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Return results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. Some maximums for limit may be enforced for performance reasons. The maximum supported value is 500. + :type limit: int + :param initiator_id: If present, only the initiator with this initiator will be returned. + :type initiator_id: int + :param role: If present, only the audit trail initiated by s user with privileged role acting as privileged user will be returned. Privileged eliglible roles: User Provisioning (USER_PROVISIONING), Content Management (CONTENT_MANAGEMENT), Expression Filter Policy Management (EF_POLICY_MANAGEMENT), SCO (SUPER_COMPLIANCE_OFFICER), CO (COMPLIANCE_OFFICER), Super admin (SUPER_ADMINISTRATOR), Admin (ADMINISTRATOR), L1 (L1_SUPPORT), L2 (L2_SUPPORT), Scope Manager (SCOPE_MANAGEMENT) + :type role: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_audittrail_privilegeduser_get_serialize( + session_token=session_token, + start_timestamp=start_timestamp, + key_manager_token=key_manager_token, + end_timestamp=end_timestamp, + before=before, + after=after, + limit=limit, + initiator_id=initiator_id, + role=role, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1AuditTrailInitiatorList", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['start_timestamp'] = \ - start_timestamp - return self.v1_audittrail_privilegeduser_get_endpoint.call_with_http_info(**kwargs) + return response_data.response + + + def _v1_audittrail_privilegeduser_get_serialize( + self, + session_token, + start_timestamp, + key_manager_token, + end_timestamp, + before, + after, + limit, + initiator_id, + role, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if start_timestamp is not None: + + _query_params.append(('startTimestamp', start_timestamp)) + + if end_timestamp is not None: + + _query_params.append(('endTimestamp', end_timestamp)) + + if before is not None: + + _query_params.append(('before', before)) + + if after is not None: + + _query_params.append(('after', after)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if initiator_id is not None: + + _query_params.append(('initiatorId', initiator_id)) + + if role is not None: + + _query_params.append(('role', role)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/audittrail/privilegeduser', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/agent_api/datafeed_api.py b/symphony/bdk/gen/agent_api/datafeed_api.py index c33ba7af..bd0102ea 100644 --- a/symphony/bdk/gen/agent_api/datafeed_api.py +++ b/symphony/bdk/gen/agent_api/datafeed_api.py @@ -1,1336 +1,2850 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) +from pydantic import Field, StrictInt, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.agent_model.ack_id import AckId from symphony.bdk.gen.agent_model.datafeed import Datafeed -from symphony.bdk.gen.agent_model.error import Error -from symphony.bdk.gen.agent_model.message_list import MessageList +from symphony.bdk.gen.agent_model.message import Message +from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage from symphony.bdk.gen.agent_model.v2_error import V2Error -from symphony.bdk.gen.agent_model.v2_message_list import V2MessageList -from symphony.bdk.gen.agent_model.v4_event_list import V4EventList +from symphony.bdk.gen.agent_model.v4_event import V4Event from symphony.bdk.gen.agent_model.v5_datafeed import V5Datafeed from symphony.bdk.gen.agent_model.v5_datafeed_create_body import V5DatafeedCreateBody from symphony.bdk.gen.agent_model.v5_event_list import V5EventList +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class DatafeedApi(object): +class DatafeedApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.create_datafeed_endpoint = _Endpoint( - settings={ - 'response_type': (V5Datafeed,), - 'auth': [], - 'endpoint_path': '/v5/datafeeds', - 'operation_id': 'create_datafeed', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'key_manager_token', - 'body', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'key_manager_token': - (str,), - 'body': - (V5DatafeedCreateBody,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'key_manager_token': 'header', - 'body': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.delete_datafeed_endpoint = _Endpoint( - settings={ - 'response_type': (V2Error,), - 'auth': [], - 'endpoint_path': '/v5/datafeeds/{datafeedId}', - 'operation_id': 'delete_datafeed', - 'http_method': 'DELETE', - 'servers': None, - }, - params_map={ - 'all': [ - 'datafeed_id', - 'session_token', - 'key_manager_token', - ], - 'required': [ - 'datafeed_id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'datafeed_id': - (str,), - 'session_token': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'datafeed_id': 'datafeedId', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'datafeed_id': 'path', - 'session_token': 'header', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.list_datafeed_endpoint = _Endpoint( - settings={ - 'response_type': ([V5Datafeed],), - 'auth': [], - 'endpoint_path': '/v5/datafeeds', - 'operation_id': 'list_datafeed', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'key_manager_token', - 'tag', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - 'tag', - ] - }, - root_map={ - 'validations': { - ('tag',): { - 'max_length': 100, - }, - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'key_manager_token': - (str,), - 'tag': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - 'tag': 'tag', - }, - 'location_map': { - 'session_token': 'header', - 'key_manager_token': 'header', - 'tag': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.read_datafeed_endpoint = _Endpoint( - settings={ - 'response_type': (V5EventList,), - 'auth': [], - 'endpoint_path': '/v5/datafeeds/{datafeedId}/read', - 'operation_id': 'read_datafeed', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'datafeed_id', - 'session_token', - 'key_manager_token', - 'ack_id', - ], - 'required': [ - 'datafeed_id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'datafeed_id': - (str,), - 'session_token': - (str,), - 'key_manager_token': - (str,), - 'ack_id': - (AckId,), - }, - 'attribute_map': { - 'datafeed_id': 'datafeedId', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'datafeed_id': 'path', - 'session_token': 'header', - 'key_manager_token': 'header', - 'ack_id': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_datafeed_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (Datafeed,), - 'auth': [], - 'endpoint_path': '/v1/datafeed/create', - 'operation_id': 'v1_datafeed_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'key_manager_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_datafeed_id_read_get_endpoint = _Endpoint( - settings={ - 'response_type': (MessageList,), - 'auth': [], - 'endpoint_path': '/v1/datafeed/{id}/read', - 'operation_id': 'v1_datafeed_id_read_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'max_messages', - 'key_manager_token', - ], - 'required': [ - 'id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'max_messages': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - 'max_messages': 'maxMessages', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'max_messages': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + + + @validate_call + async def create_datafeed( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + body: Optional[V5DatafeedCreateBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V5Datafeed: + """Create a new real time messages / events stream (\"datafeed\"). + + _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Returns the ID of the datafeed that has just been created. This ID should then be used as input to the Read Messages/Events Stream v4 endpoint. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param body: + :type body: V5DatafeedCreateBody + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_datafeed_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "V5Datafeed", + '400': "V2Error", + '401': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def create_datafeed_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + body: Optional[V5DatafeedCreateBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V5Datafeed]: + """Create a new real time messages / events stream (\"datafeed\"). + + _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Returns the ID of the datafeed that has just been created. This ID should then be used as input to the Read Messages/Events Stream v4 endpoint. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param body: + :type body: V5DatafeedCreateBody + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_datafeed_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "V5Datafeed", + '400': "V2Error", + '401': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def create_datafeed_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + body: Optional[V5DatafeedCreateBody] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new real time messages / events stream (\"datafeed\"). + + _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Returns the ID of the datafeed that has just been created. This ID should then be used as input to the Read Messages/Events Stream v4 endpoint. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param body: + :type body: V5DatafeedCreateBody + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_datafeed_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "V5Datafeed", + '400': "V2Error", + '401': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_datafeed_serialize( + self, + session_token, + key_manager_token, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v2_datafeed_id_read_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2MessageList,), - 'auth': [], - 'endpoint_path': '/v2/datafeed/{id}/read', - 'operation_id': 'v2_datafeed_id_read_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'max_messages', - 'key_manager_token', - ], - 'required': [ - 'id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'max_messages': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - 'max_messages': 'maxMessages', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'max_messages': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v5/datafeeds', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_datafeed( + self, + datafeed_id: Annotated[StrictStr, Field(description="ID of the datafeed")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2Error: + """Delete the specified real time message / event stream (\"datafeed\"). + + _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Delete the specified datafeed. + + :param datafeed_id: ID of the datafeed (required) + :type datafeed_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_datafeed_serialize( + datafeed_id=datafeed_id, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': "V2Error", + '400': "V2Error", + '401': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_datafeed_with_http_info( + self, + datafeed_id: Annotated[StrictStr, Field(description="ID of the datafeed")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2Error]: + """Delete the specified real time message / event stream (\"datafeed\"). + + _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Delete the specified datafeed. + + :param datafeed_id: ID of the datafeed (required) + :type datafeed_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_datafeed_serialize( + datafeed_id=datafeed_id, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': "V2Error", + '400': "V2Error", + '401': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_datafeed_without_preload_content( + self, + datafeed_id: Annotated[StrictStr, Field(description="ID of the datafeed")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete the specified real time message / event stream (\"datafeed\"). + + _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Delete the specified datafeed. + + :param datafeed_id: ID of the datafeed (required) + :type datafeed_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_datafeed_serialize( + datafeed_id=datafeed_id, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': "V2Error", + '400': "V2Error", + '401': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_datafeed_serialize( + self, + datafeed_id, + session_token, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if datafeed_id is not None: + _path_params['datafeedId'] = datafeed_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v4_datafeed_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (Datafeed,), - 'auth': [], - 'endpoint_path': '/v4/datafeed/create', - 'operation_id': 'v4_datafeed_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'key_manager_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v5/datafeeds/{datafeedId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_datafeed( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + tag: Annotated[Optional[Annotated[str, Field(strict=True, max_length=100)]], Field(description="A unique identifier to ensure uniqueness of the datafeed. Used to restrict search.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V5Datafeed]: + """Read list of real time messages / events stream (\"datafeed\"). + + _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the [Real Time Events](./docs/real-time-events.md) list. In most cases, only one active datafeed per user is required at a time. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param tag: A unique identifier to ensure uniqueness of the datafeed. Used to restrict search. + :type tag: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_datafeed_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + tag=tag, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V5Datafeed]", + '400': "V2Error", + '401': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_datafeed_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + tag: Annotated[Optional[Annotated[str, Field(strict=True, max_length=100)]], Field(description="A unique identifier to ensure uniqueness of the datafeed. Used to restrict search.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V5Datafeed]]: + """Read list of real time messages / events stream (\"datafeed\"). + + _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the [Real Time Events](./docs/real-time-events.md) list. In most cases, only one active datafeed per user is required at a time. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param tag: A unique identifier to ensure uniqueness of the datafeed. Used to restrict search. + :type tag: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_datafeed_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + tag=tag, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V5Datafeed]", + '400': "V2Error", + '401': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_datafeed_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + tag: Annotated[Optional[Annotated[str, Field(strict=True, max_length=100)]], Field(description="A unique identifier to ensure uniqueness of the datafeed. Used to restrict search.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Read list of real time messages / events stream (\"datafeed\"). + + _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the [Real Time Events](./docs/real-time-events.md) list. In most cases, only one active datafeed per user is required at a time. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param tag: A unique identifier to ensure uniqueness of the datafeed. Used to restrict search. + :type tag: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_datafeed_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + tag=tag, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V5Datafeed]", + '400': "V2Error", + '401': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_datafeed_serialize( + self, + session_token, + key_manager_token, + tag, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if tag is not None: + + _query_params.append(('tag', tag)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v4_datafeed_id_read_get_endpoint = _Endpoint( - settings={ - 'response_type': (V4EventList,), - 'auth': [], - 'endpoint_path': '/v4/datafeed/{id}/read', - 'operation_id': 'v4_datafeed_id_read_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'limit', - 'key_manager_token', - ], - 'required': [ - 'id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'limit': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - 'limit': 'limit', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'limit': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v5/datafeeds', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def create_datafeed( + + + + @validate_call + async def read_datafeed( self, - session_token, - **kwargs - ): - """Create a new real time messages / events stream (\"datafeed\"). # noqa: E501 - - _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Returns the ID of the datafeed that has just been created. This ID should then be used as input to the Read Messages/Events Stream v4 endpoint. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.create_datafeed(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - body (V5DatafeedCreateBody): [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V5Datafeed - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.create_datafeed_endpoint.call_with_http_info(**kwargs) - - def delete_datafeed( + datafeed_id: Annotated[StrictStr, Field(description="ID of the datafeed")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + ack_id: Optional[AckId] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V5EventList: + """Read messages and events from the real time feed identified by its {datafeedId}. + + Available on Agent 2.57.0 and above. The datafeed provides messages and events from all conversations that the user is in, in real time. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Read the specified datafeed. The ackId sent as parameter must be null for the first call. In the response an ackId will be sent back and it must be used for the next call: in this way you acknowledge that you have received the events that came with that ackId; datafeed will remove the events associated with that ackId from your queue + + :param datafeed_id: ID of the datafeed (required) + :type datafeed_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param ack_id: + :type ack_id: AckId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._read_datafeed_serialize( + datafeed_id=datafeed_id, + session_token=session_token, + key_manager_token=key_manager_token, + ack_id=ack_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V5EventList", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def read_datafeed_with_http_info( self, - datafeed_id, - session_token, - **kwargs - ): - """Delete the specified real time message / event stream (\"datafeed\"). # noqa: E501 - - _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Delete the specified datafeed. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.delete_datafeed(datafeed_id, session_token, async_req=True) - >>> result = thread.get() - - Args: - datafeed_id (str): ID of the datafeed - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2Error - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['datafeed_id'] = \ - datafeed_id - kwargs['session_token'] = \ - session_token - return self.delete_datafeed_endpoint.call_with_http_info(**kwargs) - - def list_datafeed( + datafeed_id: Annotated[StrictStr, Field(description="ID of the datafeed")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + ack_id: Optional[AckId] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V5EventList]: + """Read messages and events from the real time feed identified by its {datafeedId}. + + Available on Agent 2.57.0 and above. The datafeed provides messages and events from all conversations that the user is in, in real time. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Read the specified datafeed. The ackId sent as parameter must be null for the first call. In the response an ackId will be sent back and it must be used for the next call: in this way you acknowledge that you have received the events that came with that ackId; datafeed will remove the events associated with that ackId from your queue + + :param datafeed_id: ID of the datafeed (required) + :type datafeed_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param ack_id: + :type ack_id: AckId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._read_datafeed_serialize( + datafeed_id=datafeed_id, + session_token=session_token, + key_manager_token=key_manager_token, + ack_id=ack_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V5EventList", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def read_datafeed_without_preload_content( self, - session_token, - **kwargs - ): - """Read list of real time messages / events stream (\"datafeed\"). # noqa: E501 - - _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the [Real Time Events](./docs/real-time-events.md) list. Returns the list of the datafeeds for the user. Any datafeed ID of the list can then be used as input to the Read Messages/Events Stream v4 endpoint. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.list_datafeed(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - tag (str): A unique identifier to ensure uniqueness of the datafeed. Used to restrict search.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - [V5Datafeed] - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.list_datafeed_endpoint.call_with_http_info(**kwargs) - - def read_datafeed( + datafeed_id: Annotated[StrictStr, Field(description="ID of the datafeed")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + ack_id: Optional[AckId] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Read messages and events from the real time feed identified by its {datafeedId}. + + Available on Agent 2.57.0 and above. The datafeed provides messages and events from all conversations that the user is in, in real time. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Read the specified datafeed. The ackId sent as parameter must be null for the first call. In the response an ackId will be sent back and it must be used for the next call: in this way you acknowledge that you have received the events that came with that ackId; datafeed will remove the events associated with that ackId from your queue + + :param datafeed_id: ID of the datafeed (required) + :type datafeed_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param ack_id: + :type ack_id: AckId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._read_datafeed_serialize( + datafeed_id=datafeed_id, + session_token=session_token, + key_manager_token=key_manager_token, + ack_id=ack_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V5EventList", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _read_datafeed_serialize( self, datafeed_id, session_token, - **kwargs - ): - """Read the specified real time message / event stream (\"datafeed\"). # noqa: E501 - - _Available on Agent 2.57.0 and above._ The datafeed provides messages and events from all conversations that the user is in. The types of events surfaced in the datafeed can be found in the Real Time Events list. (see definition on top of the file) Read the specified datafeed. The ackId sent as parameter can be empty for the first call. In the response an ackId will be sent back and it can be used for the next call: in this way you acknowledge that you have received the events that came with that ackId; datafeed will remove the events associated with that ackId from your queue # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.read_datafeed(datafeed_id, session_token, async_req=True) - >>> result = thread.get() - - Args: - datafeed_id (str): ID of the datafeed - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - ack_id (AckId): ackId received from last POST Base64 encoded.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V5EventList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['datafeed_id'] = \ - datafeed_id - kwargs['session_token'] = \ - session_token - return self.read_datafeed_endpoint.call_with_http_info(**kwargs) - - def v1_datafeed_create_post( + key_manager_token, + ack_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if datafeed_id is not None: + _path_params['datafeedId'] = datafeed_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if ack_id is not None: + _body_params = ack_id + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v5/datafeeds/{datafeedId}/read', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_datafeed_create_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Datafeed: + """(Deprecated) Create a new real time message event stream. + + A datafeed provides the messages in all conversations that a user is in. System messages like new users joining a chatroom are not part of the datafeed. A datafeed will expire after if it isn't read before its capacity is reached. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/datafeed/create is deprecated.", DeprecationWarning) + + _param = self._v1_datafeed_create_post_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Datafeed", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + '503': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_datafeed_create_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Datafeed]: + """(Deprecated) Create a new real time message event stream. + + A datafeed provides the messages in all conversations that a user is in. System messages like new users joining a chatroom are not part of the datafeed. A datafeed will expire after if it isn't read before its capacity is reached. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/datafeed/create is deprecated.", DeprecationWarning) + + _param = self._v1_datafeed_create_post_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Datafeed", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + '503': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_datafeed_create_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Create a new real time message event stream. + + A datafeed provides the messages in all conversations that a user is in. System messages like new users joining a chatroom are not part of the datafeed. A datafeed will expire after if it isn't read before its capacity is reached. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/datafeed/create is deprecated.", DeprecationWarning) + + _param = self._v1_datafeed_create_post_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Datafeed", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + '503': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_datafeed_create_post_serialize( self, session_token, - **kwargs - ): - """Create a new real time message event stream. # noqa: E501 - - A datafeed provides the messages in all conversations that a user is in. System messages like new users joining a chatroom are not part of the datafeed. A datafeed will expire after if it isn't read before its capacity is reached. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_datafeed_create_post(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Datafeed - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_datafeed_create_post_endpoint.call_with_http_info(**kwargs) - - def v1_datafeed_id_read_get( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/datafeed/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_datafeed_id_read_get( + self, + id: Annotated[StrictStr, Field(description="Datafeed ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + max_messages: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[Message]: + """(Deprecated) Read a given datafeed. + + Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. + + :param id: Datafeed ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param max_messages: Max No. of messages to return. + :type max_messages: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v1/datafeed/{id}/read is deprecated.", DeprecationWarning) + + _param = self._v1_datafeed_id_read_get_serialize( + id=id, + session_token=session_token, + max_messages=max_messages, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Message]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_datafeed_id_read_get_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Datafeed ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + max_messages: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[Message]]: + """(Deprecated) Read a given datafeed. + + Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. + + :param id: Datafeed ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param max_messages: Max No. of messages to return. + :type max_messages: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v1/datafeed/{id}/read is deprecated.", DeprecationWarning) + + _param = self._v1_datafeed_id_read_get_serialize( + id=id, + session_token=session_token, + max_messages=max_messages, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Message]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_datafeed_id_read_get_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Datafeed ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + max_messages: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Read a given datafeed. + + Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. + + :param id: Datafeed ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param max_messages: Max No. of messages to return. + :type max_messages: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v1/datafeed/{id}/read is deprecated.", DeprecationWarning) + + _param = self._v1_datafeed_id_read_get_serialize( + id=id, + session_token=session_token, + max_messages=max_messages, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Message]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_datafeed_id_read_get_serialize( self, id, session_token, - **kwargs - ): - """Read a given datafeed. # noqa: E501 - - Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_datafeed_id_read_get(id, session_token, async_req=True) - >>> result = thread.get() - - Args: - id (str): Datafeed ID - session_token (str): Session authentication token. - - Keyword Args: - max_messages (int): Max No. of messages to return.. [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - MessageList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - return self.v1_datafeed_id_read_get_endpoint.call_with_http_info(**kwargs) - - def v2_datafeed_id_read_get( + max_messages, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if max_messages is not None: + + _query_params.append(('maxMessages', max_messages)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/datafeed/{id}/read', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_datafeed_id_read_get( + self, + id: Annotated[StrictStr, Field(description="Datafeed ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + max_messages: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V2BaseMessage]: + """(Deprecated) Read a given datafeed. + + Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. + + :param id: Datafeed ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param max_messages: Max No. of messages to return. + :type max_messages: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v2/datafeed/{id}/read is deprecated.", DeprecationWarning) + + _param = self._v2_datafeed_id_read_get_serialize( + id=id, + session_token=session_token, + max_messages=max_messages, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2BaseMessage]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_datafeed_id_read_get_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Datafeed ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + max_messages: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V2BaseMessage]]: + """(Deprecated) Read a given datafeed. + + Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. + + :param id: Datafeed ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param max_messages: Max No. of messages to return. + :type max_messages: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v2/datafeed/{id}/read is deprecated.", DeprecationWarning) + + _param = self._v2_datafeed_id_read_get_serialize( + id=id, + session_token=session_token, + max_messages=max_messages, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2BaseMessage]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_datafeed_id_read_get_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Datafeed ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + max_messages: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Read a given datafeed. + + Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. + + :param id: Datafeed ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param max_messages: Max No. of messages to return. + :type max_messages: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v2/datafeed/{id}/read is deprecated.", DeprecationWarning) + + _param = self._v2_datafeed_id_read_get_serialize( + id=id, + session_token=session_token, + max_messages=max_messages, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2BaseMessage]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_datafeed_id_read_get_serialize( self, id, session_token, - **kwargs - ): - """Read a given datafeed. # noqa: E501 - - Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v2_datafeed_id_read_get(id, session_token, async_req=True) - >>> result = thread.get() - - Args: - id (str): Datafeed ID - session_token (str): Session authentication token. - - Keyword Args: - max_messages (int): Max No. of messages to return.. [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2MessageList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - return self.v2_datafeed_id_read_get_endpoint.call_with_http_info(**kwargs) - - def v4_datafeed_create_post( + max_messages, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if max_messages is not None: + + _query_params.append(('maxMessages', max_messages)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/datafeed/{id}/read', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v4_datafeed_create_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Datafeed: + """(Deprecated) (Deprecated - Datafeed v1 will be fully replaced by the datafeed 2 service in the future. Please consider migrating over to datafeed 2 APIs /agent/v5/datafeeds. For more information on the timeline as well as on the benefits of datafeed 2, please reach out to your Technical Account Manager or to our developer documentation https://docs.developers.symphony.com/building-bots-on-symphony/datafeed) Create a new real time message event stream. + + A datafeed provides the messages in all conversations that a user is in. This also includes system messages like new users joining a chatroom. A datafeed will expire if it isn't read before its capacity is reached. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v4/datafeed/create is deprecated.", DeprecationWarning) + + _param = self._v4_datafeed_create_post_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Datafeed", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + '503': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v4_datafeed_create_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Datafeed]: + """(Deprecated) (Deprecated - Datafeed v1 will be fully replaced by the datafeed 2 service in the future. Please consider migrating over to datafeed 2 APIs /agent/v5/datafeeds. For more information on the timeline as well as on the benefits of datafeed 2, please reach out to your Technical Account Manager or to our developer documentation https://docs.developers.symphony.com/building-bots-on-symphony/datafeed) Create a new real time message event stream. + + A datafeed provides the messages in all conversations that a user is in. This also includes system messages like new users joining a chatroom. A datafeed will expire if it isn't read before its capacity is reached. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v4/datafeed/create is deprecated.", DeprecationWarning) + + _param = self._v4_datafeed_create_post_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Datafeed", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + '503': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v4_datafeed_create_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) (Deprecated - Datafeed v1 will be fully replaced by the datafeed 2 service in the future. Please consider migrating over to datafeed 2 APIs /agent/v5/datafeeds. For more information on the timeline as well as on the benefits of datafeed 2, please reach out to your Technical Account Manager or to our developer documentation https://docs.developers.symphony.com/building-bots-on-symphony/datafeed) Create a new real time message event stream. + + A datafeed provides the messages in all conversations that a user is in. This also includes system messages like new users joining a chatroom. A datafeed will expire if it isn't read before its capacity is reached. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v4/datafeed/create is deprecated.", DeprecationWarning) + + _param = self._v4_datafeed_create_post_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Datafeed", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + '503': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v4_datafeed_create_post_serialize( self, session_token, - **kwargs - ): - """(Deprecated - Datafeed v1 will be fully replaced by the datafeed 2 service in the future. Please consider migrating over to datafeed 2 APIs /agent/v5/datafeeds. For more information on the timeline as well as on the benefits of datafeed 2, please reach out to your Technical Account Manager or to our developer documentation https://docs.developers.symphony.com/building-bots-on-symphony/datafeed) Create a new real time message event stream. # noqa: E501 - - A datafeed provides the messages in all conversations that a user is in. This also includes system messages like new users joining a chatroom. A datafeed will expire if it isn't read before its capacity is reached. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v4_datafeed_create_post(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Datafeed - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v4_datafeed_create_post_endpoint.call_with_http_info(**kwargs) - - def v4_datafeed_id_read_get( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v4/datafeed/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v4_datafeed_id_read_get( + self, + id: Annotated[StrictStr, Field(description="Datafeed ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + limit: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V4Event]: + """(Deprecated) (Deprecated - Datafeed v1 will be fully replaced by the datafeed 2 service in the future. Please consider migrating over to datafeed 2 APIs /agent/v5/datafeeds/{id}/read. For more information on the timeline as well as on the benefits of datafeed 2, please reach out to your Technical Account Manager or to our developer documentation https://docs.developers.symphony.com/building-bots-on-symphony/datafeed) Read a given datafeed. + + Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. + + :param id: Datafeed ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param limit: Max No. of messages to return. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v4/datafeed/{id}/read is deprecated.", DeprecationWarning) + + _param = self._v4_datafeed_id_read_get_serialize( + id=id, + session_token=session_token, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Event]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v4_datafeed_id_read_get_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Datafeed ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + limit: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V4Event]]: + """(Deprecated) (Deprecated - Datafeed v1 will be fully replaced by the datafeed 2 service in the future. Please consider migrating over to datafeed 2 APIs /agent/v5/datafeeds/{id}/read. For more information on the timeline as well as on the benefits of datafeed 2, please reach out to your Technical Account Manager or to our developer documentation https://docs.developers.symphony.com/building-bots-on-symphony/datafeed) Read a given datafeed. + + Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. + + :param id: Datafeed ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param limit: Max No. of messages to return. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v4/datafeed/{id}/read is deprecated.", DeprecationWarning) + + _param = self._v4_datafeed_id_read_get_serialize( + id=id, + session_token=session_token, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Event]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v4_datafeed_id_read_get_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Datafeed ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + limit: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) (Deprecated - Datafeed v1 will be fully replaced by the datafeed 2 service in the future. Please consider migrating over to datafeed 2 APIs /agent/v5/datafeeds/{id}/read. For more information on the timeline as well as on the benefits of datafeed 2, please reach out to your Technical Account Manager or to our developer documentation https://docs.developers.symphony.com/building-bots-on-symphony/datafeed) Read a given datafeed. + + Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. + + :param id: Datafeed ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param limit: Max No. of messages to return. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v4/datafeed/{id}/read is deprecated.", DeprecationWarning) + + _param = self._v4_datafeed_id_read_get_serialize( + id=id, + session_token=session_token, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Event]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v4_datafeed_id_read_get_serialize( self, id, session_token, - **kwargs - ): - """(Deprecated - Datafeed v1 will be fully replaced by the datafeed 2 service in the future. Please consider migrating over to datafeed 2 APIs /agent/v5/datafeeds/{id}/read. For more information on the timeline as well as on the benefits of datafeed 2, please reach out to your Technical Account Manager or to our developer documentation https://docs.developers.symphony.com/building-bots-on-symphony/datafeed) Read a given datafeed. # noqa: E501 - - Read messages from the given datafeed. If no more messages are available then this method will block. It is intended that the client should re-call this method as soon as it has processed the messages received in the previous call. If the client is able to consume messages more quickly than they become available then each call will initially block, there is no need to delay before re-calling this method. A datafeed will expire if its unread capacity is reached. A datafeed can only be consumed by one client thread at a time. E.g. polling the datafeed by two threads may lead to messages being delivered out of order. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v4_datafeed_id_read_get(id, session_token, async_req=True) - >>> result = thread.get() - - Args: - id (str): Datafeed ID - session_token (str): Session authentication token. - - Keyword Args: - limit (int): Max No. of messages to return.. [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V4EventList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - return self.v4_datafeed_id_read_get_endpoint.call_with_http_info(**kwargs) + limit, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v4/datafeed/{id}/read', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/agent_api/datahose_api.py b/symphony/bdk/gen/agent_api/datahose_api.py index cc43c6e6..9eebd21c 100644 --- a/symphony/bdk/gen/agent_api/datahose_api.py +++ b/symphony/bdk/gen/agent_api/datahose_api.py @@ -1,184 +1,355 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.agent_model.v2_error import V2Error +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated from symphony.bdk.gen.agent_model.v5_event_list import V5EventList from symphony.bdk.gen.agent_model.v5_events_read_body import V5EventsReadBody +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class DatahoseApi(object): + +class DatahoseApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.read_events_endpoint = _Endpoint( - settings={ - 'response_type': (V5EventList,), - 'auth': [], - 'endpoint_path': '/v5/events/read', - 'operation_id': 'read_events', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'body', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'body', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'body': - (V5EventsReadBody,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'body': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - def read_events( + + @validate_call + async def read_events( self, - session_token, - body, - **kwargs - ): - """Creates and Reads a real time feed of messages and events of your pod (Datahose) # noqa: E501 - - _Available on Agent 22.5.1 and above._ This API provides a real time feed of all the messages and events in the pod, even from conversations where the calling service user is not a member. The types of events surfaced can be found in the Real Time Events list. In case you retrieving SOCIALMESSAGE events, the credentials of the ceservice account must be properly configured in the Agent. The types of events returned can be found in the Real Time Events list (see definition on top of the file). The ackId sent as parameter can be empty for the first call. In the response an ackId will be sent back and it can be used for the next call: in this way you acknowledge that you have received the events that came with that ackId. If you have several instances of the same bot, they must share the same feed so that events are spread across all bot instances. To do so, you must: share the same service account provide the same \"tag\" and same \"filters\" values. The Datahose API is an add-on to the Symphony Services, and is subject to additional charges. Prior to using Datahose in your Symphony environment(s), you will need to enter into a specific contract. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.read_events(session_token, body, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - body (V5EventsReadBody): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V5EventList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: V5EventsReadBody, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V5EventList: + """Creates and Reads a real time feed of messages and events of your pod (Datahose) + + Available on Agent 22.5.1 and above. This API provides a real time feed of all the messages and events in the pod, even from conversations where the calling service account is not a member. The types of events surfaced can be found in the Real Time Events list. In case you retrieving SOCIALMESSAGE events, the credentials of the ceservice account must be properly configured in the Agent. The types of events returned can be found in the Real Time Events list (see definition on top of the file). The ackId sent as parameter must be empty for the first call. In the response an ackId will be sent back and it can be used for the next call: in this way you acknowledge that you have received the events that came with that ackId. If you have several instances of the same bot, they must share the same feed so that events are spread across all bot instances. To do so, you must: share the same service account provide the same \"tag\" and same \"filters\" values. The Datahose API is an add-on to the Symphony Services, and is subject to additional charges. Prior to using Datahose in your Symphony environment(s), you will need to enter into a specific contract. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: (required) + :type body: V5EventsReadBody + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._read_events_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V5EventList", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def read_events_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: V5EventsReadBody, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V5EventList]: + """Creates and Reads a real time feed of messages and events of your pod (Datahose) + + Available on Agent 22.5.1 and above. This API provides a real time feed of all the messages and events in the pod, even from conversations where the calling service account is not a member. The types of events surfaced can be found in the Real Time Events list. In case you retrieving SOCIALMESSAGE events, the credentials of the ceservice account must be properly configured in the Agent. The types of events returned can be found in the Real Time Events list (see definition on top of the file). The ackId sent as parameter must be empty for the first call. In the response an ackId will be sent back and it can be used for the next call: in this way you acknowledge that you have received the events that came with that ackId. If you have several instances of the same bot, they must share the same feed so that events are spread across all bot instances. To do so, you must: share the same service account provide the same \"tag\" and same \"filters\" values. The Datahose API is an add-on to the Symphony Services, and is subject to additional charges. Prior to using Datahose in your Symphony environment(s), you will need to enter into a specific contract. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: (required) + :type body: V5EventsReadBody + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._read_events_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V5EventList", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def read_events_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: V5EventsReadBody, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Creates and Reads a real time feed of messages and events of your pod (Datahose) + + Available on Agent 22.5.1 and above. This API provides a real time feed of all the messages and events in the pod, even from conversations where the calling service account is not a member. The types of events surfaced can be found in the Real Time Events list. In case you retrieving SOCIALMESSAGE events, the credentials of the ceservice account must be properly configured in the Agent. The types of events returned can be found in the Real Time Events list (see definition on top of the file). The ackId sent as parameter must be empty for the first call. In the response an ackId will be sent back and it can be used for the next call: in this way you acknowledge that you have received the events that came with that ackId. If you have several instances of the same bot, they must share the same feed so that events are spread across all bot instances. To do so, you must: share the same service account provide the same \"tag\" and same \"filters\" values. The Datahose API is an add-on to the Symphony Services, and is subject to additional charges. Prior to using Datahose in your Symphony environment(s), you will need to enter into a specific contract. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: (required) + :type body: V5EventsReadBody + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._read_events_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V5EventList", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + return response_data.response + + + def _read_events_serialize( + self, + session_token, + body, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v5/events/read', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['body'] = \ - body - return self.read_events_endpoint.call_with_http_info(**kwargs) + diff --git a/symphony/bdk/gen/agent_api/dlp_policies_and_dictionary_management_api.py b/symphony/bdk/gen/agent_api/dlp_policies_and_dictionary_management_api.py index a56e4932..56839165 100644 --- a/symphony/bdk/gen/agent_api/dlp_policies_and_dictionary_management_api.py +++ b/symphony/bdk/gen/agent_api/dlp_policies_and_dictionary_management_api.py @@ -1,27 +1,24 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.agent_model.error import Error +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBytes, StrictInt, StrictStr +from typing import Optional, Tuple, Union +from typing_extensions import Annotated from symphony.bdk.gen.agent_model.v1_dlp_dictionary_metadata_collection_response import V1DLPDictionaryMetadataCollectionResponse from symphony.bdk.gen.agent_model.v1_dlp_dictionary_metadata_create_request import V1DLPDictionaryMetadataCreateRequest from symphony.bdk.gen.agent_model.v1_dlp_dictionary_metadata_response import V1DLPDictionaryMetadataResponse @@ -33,3097 +30,6637 @@ from symphony.bdk.gen.agent_model.v3_dlp_policy_request import V3DLPPolicyRequest from symphony.bdk.gen.agent_model.v3_dlp_policy_response import V3DLPPolicyResponse +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class DLPPoliciesAndDictionaryManagementApi(object): +class DLPPoliciesAndDictionaryManagementApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_dlp_dictionaries_dict_id_data_download_get_endpoint = _Endpoint( - settings={ - 'response_type': (str,), - 'auth': [], - 'endpoint_path': '/v1/dlp/dictionaries/{dictId}/data/download', - 'operation_id': 'v1_dlp_dictionaries_dict_id_data_download_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'dict_id', - 'key_manager_token', - 'dict_version', - ], - 'required': [ - 'session_token', - 'dict_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'dict_id': - (str,), - 'key_manager_token': - (str,), - 'dict_version': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'dict_id': 'dictId', - 'key_manager_token': 'keyManagerToken', - 'dict_version': 'dictVersion', - }, - 'location_map': { - 'session_token': 'header', - 'dict_id': 'path', - 'key_manager_token': 'header', - 'dict_version': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + + + @validate_call + async def v1_dlp_dictionaries_dict_id_data_download_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + dict_version: Annotated[Optional[StrictStr], Field(description="If set to be valid dictionary version number, will return dictionary with specified version. Otherwise, return the latest dictionary. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytearray: + """Downloads Base 64 encoded dictionary content. + + Downloads Base 64 encoded dictionary content. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param dict_version: If set to be valid dictionary version number, will return dictionary with specified version. Otherwise, return the latest dictionary. + :type dict_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_data_download_get_serialize( + session_token=session_token, + dict_id=dict_id, + key_manager_token=key_manager_token, + dict_version=dict_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_dictionaries_dict_id_data_download_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + dict_version: Annotated[Optional[StrictStr], Field(description="If set to be valid dictionary version number, will return dictionary with specified version. Otherwise, return the latest dictionary. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytearray]: + """Downloads Base 64 encoded dictionary content. + + Downloads Base 64 encoded dictionary content. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param dict_version: If set to be valid dictionary version number, will return dictionary with specified version. Otherwise, return the latest dictionary. + :type dict_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_data_download_get_serialize( + session_token=session_token, + dict_id=dict_id, + key_manager_token=key_manager_token, + dict_version=dict_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_dictionaries_dict_id_data_download_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + dict_version: Annotated[Optional[StrictStr], Field(description="If set to be valid dictionary version number, will return dictionary with specified version. Otherwise, return the latest dictionary. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Downloads Base 64 encoded dictionary content. + + Downloads Base 64 encoded dictionary content. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param dict_version: If set to be valid dictionary version number, will return dictionary with specified version. Otherwise, return the latest dictionary. + :type dict_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_data_download_get_serialize( + session_token=session_token, + dict_id=dict_id, + key_manager_token=key_manager_token, + dict_version=dict_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_dictionaries_dict_id_data_download_get_serialize( + self, + session_token, + dict_id, + key_manager_token, + dict_version, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if dict_id is not None: + _path_params['dictId'] = dict_id + # process the query parameters + if dict_version is not None: + + _query_params.append(('dictVersion', dict_version)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/octet-stream' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_dlp_dictionaries_dict_id_data_upload_post_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPDictionaryMetadataResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/dictionaries/{dictId}/data/upload', - 'operation_id': 'v1_dlp_dictionaries_dict_id_data_upload_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'dict_id', - 'data', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'dict_id', - 'data', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'dict_id': - (str,), - 'data': - (file_type,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'dict_id': 'dictId', - 'data': 'data', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'dict_id': 'path', - 'data': 'form', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'multipart/form-data' - ] - }, - api_client=api_client - ) - self.v1_dlp_dictionaries_dict_id_delete_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPDictionaryMetadataResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/dictionaries/{dictId}', - 'operation_id': 'v1_dlp_dictionaries_dict_id_delete', - 'http_method': 'DELETE', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'dict_id', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'dict_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'dict_id': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'dict_id': 'dictId', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'dict_id': 'path', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_dlp_dictionaries_dict_id_get_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPDictionaryMetadataResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/dictionaries/{dictId}', - 'operation_id': 'v1_dlp_dictionaries_dict_id_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'dict_id', - 'key_manager_token', - 'dict_version', - ], - 'required': [ - 'session_token', - 'dict_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'dict_id': - (str,), - 'key_manager_token': - (str,), - 'dict_version': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'dict_id': 'dictId', - 'key_manager_token': 'keyManagerToken', - 'dict_version': 'dictVersion', - }, - 'location_map': { - 'session_token': 'header', - 'dict_id': 'path', - 'key_manager_token': 'header', - 'dict_version': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_dlp_dictionaries_dict_id_put_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPDictionaryMetadataResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/dictionaries/{dictId}', - 'operation_id': 'v1_dlp_dictionaries_dict_id_put', - 'http_method': 'PUT', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'dict_id', - 'body', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'dict_id', - 'body', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'dict_id': - (str,), - 'body': - (V1DLPDictionaryMetadataUpdateRequest,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'dict_id': 'dictId', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'dict_id': 'path', - 'body': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_dlp_dictionaries_get_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPDictionaryMetadataCollectionResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/dictionaries', - 'operation_id': 'v1_dlp_dictionaries_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'key_manager_token', - 'page', - 'limit', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'key_manager_token': - (str,), - 'page': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - 'page': 'page', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'key_manager_token': 'header', - 'page': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_dlp_dictionaries_post_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPDictionaryMetadataResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/dictionaries', - 'operation_id': 'v1_dlp_dictionaries_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'body', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'body', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'body': - (V1DLPDictionaryMetadataCreateRequest,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'body': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_dlp_policies_get_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPPoliciesCollectionResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/policies', - 'operation_id': 'v1_dlp_policies_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'key_manager_token', - 'page', - 'limit', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'key_manager_token': - (str,), - 'page': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - 'page': 'page', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'key_manager_token': 'header', - 'page': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_dlp_policies_policy_id_delete_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/policies/{policyId}', - 'operation_id': 'v1_dlp_policies_policy_id_delete', - 'http_method': 'DELETE', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'policy_id', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'policy_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'policy_id': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'policy_id': 'policyId', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'policy_id': 'path', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_dlp_policies_policy_id_disable_post_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/policies/{policyId}/disable', - 'operation_id': 'v1_dlp_policies_policy_id_disable_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'policy_id', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'policy_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'policy_id': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'policy_id': 'policyId', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'policy_id': 'path', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_dlp_policies_policy_id_enable_post_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/policies/{policyId}/enable', - 'operation_id': 'v1_dlp_policies_policy_id_enable_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'policy_id', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'policy_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'policy_id': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'policy_id': 'policyId', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'policy_id': 'path', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_dlp_policies_policy_id_get_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/policies/{policyId}', - 'operation_id': 'v1_dlp_policies_policy_id_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'policy_id', - 'key_manager_token', - 'policy_version', - ], - 'required': [ - 'session_token', - 'policy_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'policy_id': - (str,), - 'key_manager_token': - (str,), - 'policy_version': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'policy_id': 'policyId', - 'key_manager_token': 'keyManagerToken', - 'policy_version': 'policyVersion', - }, - 'location_map': { - 'session_token': 'header', - 'policy_id': 'path', - 'key_manager_token': 'header', - 'policy_version': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_dlp_policies_policy_id_put_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/policies/{policyId}', - 'operation_id': 'v1_dlp_policies_policy_id_put', - 'http_method': 'PUT', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'policy_id', - 'body', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'policy_id', - 'body', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'policy_id': - (str,), - 'body': - (V1DLPPolicyRequest,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'policy_id': 'policyId', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'policy_id': 'path', - 'body': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_dlp_policies_post_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/policies', - 'operation_id': 'v1_dlp_policies_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'body', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'body', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'body': - (V1DLPPolicyRequest,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'body': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v3_dlp_policies_get_endpoint = _Endpoint( - settings={ - 'response_type': (V3DLPPoliciesCollectionResponse,), - 'auth': [], - 'endpoint_path': '/v3/dlp/policies', - 'operation_id': 'v3_dlp_policies_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'key_manager_token', - 'page', - 'limit', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'key_manager_token': - (str,), - 'page': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - 'page': 'page', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'key_manager_token': 'header', - 'page': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_dlp_policies_policy_id_delete_post_endpoint = _Endpoint( - settings={ - 'response_type': (V3DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v3/dlp/policies/{policyId}/delete', - 'operation_id': 'v3_dlp_policies_policy_id_delete_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'policy_id', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'policy_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'policy_id': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'policy_id': 'policyId', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'policy_id': 'path', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_dlp_policies_policy_id_disable_post_endpoint = _Endpoint( - settings={ - 'response_type': (V3DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v3/dlp/policies/{policyId}/disable', - 'operation_id': 'v3_dlp_policies_policy_id_disable_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'policy_id', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'policy_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'policy_id': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'policy_id': 'policyId', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'policy_id': 'path', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_dlp_policies_policy_id_enable_post_endpoint = _Endpoint( - settings={ - 'response_type': (V3DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v3/dlp/policies/{policyId}/enable', - 'operation_id': 'v3_dlp_policies_policy_id_enable_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'policy_id', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'policy_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'policy_id': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'policy_id': 'policyId', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'policy_id': 'path', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_dlp_policies_policy_id_get_endpoint = _Endpoint( - settings={ - 'response_type': (V3DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v3/dlp/policies/{policyId}', - 'operation_id': 'v3_dlp_policies_policy_id_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'policy_id', - 'key_manager_token', - 'policy_version', - ], - 'required': [ - 'session_token', - 'policy_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'policy_id': - (str,), - 'key_manager_token': - (str,), - 'policy_version': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'policy_id': 'policyId', - 'key_manager_token': 'keyManagerToken', - 'policy_version': 'policyVersion', - }, - 'location_map': { - 'session_token': 'header', - 'policy_id': 'path', - 'key_manager_token': 'header', - 'policy_version': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_dlp_policies_policy_id_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (V3DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v3/dlp/policies/{policyId}/update', - 'operation_id': 'v3_dlp_policies_policy_id_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'policy_id', - 'body', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'policy_id', - 'body', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'policy_id': - (str,), - 'body': - (V3DLPPolicyRequest,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'policy_id': 'policyId', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'policy_id': 'path', - 'body': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v3_dlp_policies_post_endpoint = _Endpoint( - settings={ - 'response_type': (V3DLPPolicyResponse,), - 'auth': [], - 'endpoint_path': '/v3/dlp/policies', - 'operation_id': 'v3_dlp_policies_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'body', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'body', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'body': - (V3DLPPolicyRequest,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'body': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/dlp/dictionaries/{dictId}/data/download', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def v1_dlp_dictionaries_dict_id_data_download_get( + + + + @validate_call + async def v1_dlp_dictionaries_dict_id_data_upload_post( self, - session_token, - dict_id, - **kwargs - ): - """Downloads Base 64 encoded dictionary content. # noqa: E501 - - Downloads Base 64 encoded dictionary content. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_dictionaries_dict_id_data_download_get(session_token, dict_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - dict_id (str): Unique dictionary identifier - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - dict_version (str): If set to be valid dictionary version number, will return dictionary with specified version. Otherwise, return the latest dictionary. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - str - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['dict_id'] = \ - dict_id - return self.v1_dlp_dictionaries_dict_id_data_download_get_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_dictionaries_dict_id_data_upload_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + data: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPDictionaryMetadataResponse: + """Override dictionary content with provided content. + + Override dictionary content with provided content. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param data: (required) + :type data: bytearray + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_data_upload_post_serialize( + session_token=session_token, + dict_id=dict_id, + data=data, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_dictionaries_dict_id_data_upload_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + data: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPDictionaryMetadataResponse]: + """Override dictionary content with provided content. + + Override dictionary content with provided content. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param data: (required) + :type data: bytearray + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_data_upload_post_serialize( + session_token=session_token, + dict_id=dict_id, + data=data, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_dictionaries_dict_id_data_upload_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + data: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Override dictionary content with provided content. + + Override dictionary content with provided content. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param data: (required) + :type data: bytearray + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_data_upload_post_serialize( + session_token=session_token, + dict_id=dict_id, + data=data, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_dictionaries_dict_id_data_upload_post_serialize( self, session_token, dict_id, data, - **kwargs - ): - """Override dictionary content with provided content. # noqa: E501 - - Override dictionary content with provided content. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_dictionaries_dict_id_data_upload_post(session_token, dict_id, data, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - dict_id (str): Unique dictionary identifier - data (file_type): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPDictionaryMetadataResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['dict_id'] = \ - dict_id - kwargs['data'] = \ - data - return self.v1_dlp_dictionaries_dict_id_data_upload_post_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_dictionaries_dict_id_delete( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if dict_id is not None: + _path_params['dictId'] = dict_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + if data is not None: + _files['data'] = data + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/dlp/dictionaries/{dictId}/data/upload', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_dictionaries_dict_id_delete( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPDictionaryMetadataResponse: + """Delete a dictionary + + Deletes a dictionary. Note: All related policies will be affected. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_delete_serialize( + session_token=session_token, + dict_id=dict_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_dictionaries_dict_id_delete_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPDictionaryMetadataResponse]: + """Delete a dictionary + + Deletes a dictionary. Note: All related policies will be affected. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_delete_serialize( + session_token=session_token, + dict_id=dict_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_dictionaries_dict_id_delete_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a dictionary + + Deletes a dictionary. Note: All related policies will be affected. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_delete_serialize( + session_token=session_token, + dict_id=dict_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_dictionaries_dict_id_delete_serialize( self, session_token, dict_id, - **kwargs - ): - """Delete a dictionary # noqa: E501 - - Deletes a dictionary. Note: All related policies will be affected. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_dictionaries_dict_id_delete(session_token, dict_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - dict_id (str): Unique dictionary identifier - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPDictionaryMetadataResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['dict_id'] = \ - dict_id - return self.v1_dlp_dictionaries_dict_id_delete_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_dictionaries_dict_id_get( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if dict_id is not None: + _path_params['dictId'] = dict_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/dlp/dictionaries/{dictId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_dictionaries_dict_id_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + dict_version: Annotated[Optional[StrictStr], Field(description="If set to be valid dictionary version number, will return dictionary metadata with specified version. Otherwise, return the latest dictionary metadata. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPDictionaryMetadataResponse: + """Get dictionary metadata + + Get basic information for a dictionary. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param dict_version: If set to be valid dictionary version number, will return dictionary metadata with specified version. Otherwise, return the latest dictionary metadata. + :type dict_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_get_serialize( + session_token=session_token, + dict_id=dict_id, + key_manager_token=key_manager_token, + dict_version=dict_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_dictionaries_dict_id_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + dict_version: Annotated[Optional[StrictStr], Field(description="If set to be valid dictionary version number, will return dictionary metadata with specified version. Otherwise, return the latest dictionary metadata. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPDictionaryMetadataResponse]: + """Get dictionary metadata + + Get basic information for a dictionary. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param dict_version: If set to be valid dictionary version number, will return dictionary metadata with specified version. Otherwise, return the latest dictionary metadata. + :type dict_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_get_serialize( + session_token=session_token, + dict_id=dict_id, + key_manager_token=key_manager_token, + dict_version=dict_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_dictionaries_dict_id_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + dict_version: Annotated[Optional[StrictStr], Field(description="If set to be valid dictionary version number, will return dictionary metadata with specified version. Otherwise, return the latest dictionary metadata. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get dictionary metadata + + Get basic information for a dictionary. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param dict_version: If set to be valid dictionary version number, will return dictionary metadata with specified version. Otherwise, return the latest dictionary metadata. + :type dict_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_get_serialize( + session_token=session_token, + dict_id=dict_id, + key_manager_token=key_manager_token, + dict_version=dict_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_dictionaries_dict_id_get_serialize( self, session_token, dict_id, - **kwargs - ): - """Get dictionary metadata # noqa: E501 - - Get basic information for a dictionary. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_dictionaries_dict_id_get(session_token, dict_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - dict_id (str): Unique dictionary identifier - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - dict_version (str): If set to be valid dictionary version number, will return dictionary metadata with specified version. Otherwise, return the latest dictionary metadata. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPDictionaryMetadataResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['dict_id'] = \ - dict_id - return self.v1_dlp_dictionaries_dict_id_get_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_dictionaries_dict_id_put( + key_manager_token, + dict_version, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if dict_id is not None: + _path_params['dictId'] = dict_id + # process the query parameters + if dict_version is not None: + + _query_params.append(('dictVersion', dict_version)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/dlp/dictionaries/{dictId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_dictionaries_dict_id_put( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + body: V1DLPDictionaryMetadataUpdateRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPDictionaryMetadataResponse: + """Updates a dictionary + + Updates the dictionary's basic metadata without content. This API cannot be used for creating a new dictionary. In case of update only \"name\" can be changed. Note: All related policies will also have versions updated. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param body: (required) + :type body: V1DLPDictionaryMetadataUpdateRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_put_serialize( + session_token=session_token, + dict_id=dict_id, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_dictionaries_dict_id_put_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + body: V1DLPDictionaryMetadataUpdateRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPDictionaryMetadataResponse]: + """Updates a dictionary + + Updates the dictionary's basic metadata without content. This API cannot be used for creating a new dictionary. In case of update only \"name\" can be changed. Note: All related policies will also have versions updated. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param body: (required) + :type body: V1DLPDictionaryMetadataUpdateRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_put_serialize( + session_token=session_token, + dict_id=dict_id, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_dictionaries_dict_id_put_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + dict_id: Annotated[StrictStr, Field(description="Unique dictionary identifier")], + body: V1DLPDictionaryMetadataUpdateRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Updates a dictionary + + Updates the dictionary's basic metadata without content. This API cannot be used for creating a new dictionary. In case of update only \"name\" can be changed. Note: All related policies will also have versions updated. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param dict_id: Unique dictionary identifier (required) + :type dict_id: str + :param body: (required) + :type body: V1DLPDictionaryMetadataUpdateRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_dict_id_put_serialize( + session_token=session_token, + dict_id=dict_id, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_dictionaries_dict_id_put_serialize( self, session_token, dict_id, body, - **kwargs - ): - """Updates a dictionary # noqa: E501 - - Updates the dictionary's basic metadata without content. This API cannot be used for creating a new dictionary. In case of update only \"name\" can be changed. Note: All related policies will also have versions updated. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_dictionaries_dict_id_put(session_token, dict_id, body, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - dict_id (str): Unique dictionary identifier - body (V1DLPDictionaryMetadataUpdateRequest): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPDictionaryMetadataResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['dict_id'] = \ - dict_id - kwargs['body'] = \ - body - return self.v1_dlp_dictionaries_dict_id_put_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_dictionaries_get( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if dict_id is not None: + _path_params['dictId'] = dict_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/dlp/dictionaries/{dictId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_dictionaries_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify which page to return (default is 0)")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPDictionaryMetadataCollectionResponse: + """Get all dictionary metadatas + + Get all dictionary metadatas with the latest version. Each dictionary object will only contain meta data of the content. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param page: Optional parameter to specify which page to return (default is 0) + :type page: int + :param limit: Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + page=page, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataCollectionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_dictionaries_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify which page to return (default is 0)")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPDictionaryMetadataCollectionResponse]: + """Get all dictionary metadatas + + Get all dictionary metadatas with the latest version. Each dictionary object will only contain meta data of the content. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param page: Optional parameter to specify which page to return (default is 0) + :type page: int + :param limit: Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + page=page, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataCollectionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_dictionaries_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify which page to return (default is 0)")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get all dictionary metadatas + + Get all dictionary metadatas with the latest version. Each dictionary object will only contain meta data of the content. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param page: Optional parameter to specify which page to return (default is 0) + :type page: int + :param limit: Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + page=page, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataCollectionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_dictionaries_get_serialize( self, session_token, - **kwargs - ): - """Get all dictionary metadatas # noqa: E501 - - Get all dictionary metadatas with the latest version. Each dictionary object will only contain meta data of the content. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_dictionaries_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - page (int): Optional parameter to specify which page to return (default is 0). [optional] - limit (int): Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPDictionaryMetadataCollectionResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_dlp_dictionaries_get_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_dictionaries_post( + key_manager_token, + page, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/dlp/dictionaries', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_dictionaries_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: V1DLPDictionaryMetadataCreateRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPDictionaryMetadataResponse: + """Create a dictionary + + Creates a dictionary with basic metadata and no content. Only \"name\" and \"type\" field is used to create a new dictionary entry. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: (required) + :type body: V1DLPDictionaryMetadataCreateRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_post_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_dictionaries_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: V1DLPDictionaryMetadataCreateRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPDictionaryMetadataResponse]: + """Create a dictionary + + Creates a dictionary with basic metadata and no content. Only \"name\" and \"type\" field is used to create a new dictionary entry. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: (required) + :type body: V1DLPDictionaryMetadataCreateRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_post_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_dictionaries_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: V1DLPDictionaryMetadataCreateRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a dictionary + + Creates a dictionary with basic metadata and no content. Only \"name\" and \"type\" field is used to create a new dictionary entry. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: (required) + :type body: V1DLPDictionaryMetadataCreateRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_dictionaries_post_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPDictionaryMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_dictionaries_post_serialize( self, session_token, body, - **kwargs - ): - """Create a dictionary # noqa: E501 - - Creates a dictionary with basic metadata and no content. Only \"name\" and \"type\" field is used to create a new dictionary entry. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_dictionaries_post(session_token, body, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - body (V1DLPDictionaryMetadataCreateRequest): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPDictionaryMetadataResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['body'] = \ - body - return self.v1_dlp_dictionaries_post_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_policies_get( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/dlp/dictionaries', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_policies_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify which page to return (default is 0)")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPPoliciesCollectionResponse: + """Get all policies + + Get all policies + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param page: Optional parameter to specify which page to return (default is 0) + :type page: int + :param limit: Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + page=page, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPoliciesCollectionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_policies_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify which page to return (default is 0)")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPPoliciesCollectionResponse]: + """Get all policies + + Get all policies + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param page: Optional parameter to specify which page to return (default is 0) + :type page: int + :param limit: Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + page=page, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPoliciesCollectionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_policies_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify which page to return (default is 0)")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get all policies + + Get all policies + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param page: Optional parameter to specify which page to return (default is 0) + :type page: int + :param limit: Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + page=page, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPoliciesCollectionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_policies_get_serialize( self, session_token, - **kwargs - ): - """Get all policies # noqa: E501 - - Get all policies # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_policies_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - page (int): Optional parameter to specify which page to return (default is 0). [optional] - limit (int): Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPPoliciesCollectionResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_dlp_policies_get_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_policies_policy_id_delete( + key_manager_token, + page, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/dlp/policies', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_policies_policy_id_delete( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPPolicyResponse: + """Delete a policy + + Delete a policy. Note: Only disabled policy can be deleted + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_delete_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_policies_policy_id_delete_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPPolicyResponse]: + """Delete a policy + + Delete a policy. Note: Only disabled policy can be deleted + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_delete_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_policies_policy_id_delete_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a policy + + Delete a policy. Note: Only disabled policy can be deleted + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_delete_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_policies_policy_id_delete_serialize( self, session_token, policy_id, - **kwargs - ): - """Delete a policy # noqa: E501 - - Delete a policy. Note: Only disabled policy can be deleted # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_policies_policy_id_delete(session_token, policy_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - policy_id (str): Unique dictionary identifier. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['policy_id'] = \ - policy_id - return self.v1_dlp_policies_policy_id_delete_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_policies_policy_id_disable_post( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if policy_id is not None: + _path_params['policyId'] = policy_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/dlp/policies/{policyId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_policies_policy_id_disable_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPPolicyResponse: + """Disables a policy. + + Disables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_disable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_policies_policy_id_disable_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPPolicyResponse]: + """Disables a policy. + + Disables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_disable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_policies_policy_id_disable_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Disables a policy. + + Disables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_disable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_policies_policy_id_disable_post_serialize( self, session_token, policy_id, - **kwargs - ): - """Disables a policy. # noqa: E501 - - Disables a policy. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_policies_policy_id_disable_post(session_token, policy_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - policy_id (str): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['policy_id'] = \ - policy_id - return self.v1_dlp_policies_policy_id_disable_post_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_policies_policy_id_enable_post( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if policy_id is not None: + _path_params['policyId'] = policy_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/dlp/policies/{policyId}/disable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_policies_policy_id_enable_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPPolicyResponse: + """Enables a policy. + + Enables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_enable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_policies_policy_id_enable_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPPolicyResponse]: + """Enables a policy. + + Enables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_enable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_policies_policy_id_enable_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Enables a policy. + + Enables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_enable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_policies_policy_id_enable_post_serialize( self, session_token, policy_id, - **kwargs - ): - """Enables a policy. # noqa: E501 - - Enables a policy. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_policies_policy_id_enable_post(session_token, policy_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - policy_id (str): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['policy_id'] = \ - policy_id - return self.v1_dlp_policies_policy_id_enable_post_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_policies_policy_id_get( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if policy_id is not None: + _path_params['policyId'] = policy_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/dlp/policies/{policyId}/enable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_policies_policy_id_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + policy_version: Annotated[Optional[StrictStr], Field(description="Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPPolicyResponse: + """Get a policy + + Get a policy + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param policy_version: Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. + :type policy_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_get_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + policy_version=policy_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_policies_policy_id_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + policy_version: Annotated[Optional[StrictStr], Field(description="Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPPolicyResponse]: + """Get a policy + + Get a policy + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param policy_version: Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. + :type policy_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_get_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + policy_version=policy_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_policies_policy_id_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + policy_version: Annotated[Optional[StrictStr], Field(description="Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a policy + + Get a policy + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param policy_version: Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. + :type policy_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_get_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + policy_version=policy_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_policies_policy_id_get_serialize( self, session_token, policy_id, - **kwargs - ): - """Get a policy # noqa: E501 - - Get a policy # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_policies_policy_id_get(session_token, policy_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - policy_id (str): Unique dictionary identifier. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - policy_version (str): Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['policy_id'] = \ - policy_id - return self.v1_dlp_policies_policy_id_get_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_policies_policy_id_put( + key_manager_token, + policy_version, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if policy_id is not None: + _path_params['policyId'] = policy_id + # process the query parameters + if policy_version is not None: + + _query_params.append(('policyVersion', policy_version)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/dlp/policies/{policyId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_policies_policy_id_put( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + body: V1DLPPolicyRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPPolicyResponse: + """Updates a policy. Cannot be used for creation. + + Update the policy (name, type, contentTypes, scopes) and also the dictionaries for a policy. Warning: If you send empty list of dictionaries during the update operation, then all the dictionaries for this policy are deleted and policy is automatically disabled. Note: The policy should already exist. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param body: (required) + :type body: V1DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_put_serialize( + session_token=session_token, + policy_id=policy_id, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_policies_policy_id_put_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + body: V1DLPPolicyRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPPolicyResponse]: + """Updates a policy. Cannot be used for creation. + + Update the policy (name, type, contentTypes, scopes) and also the dictionaries for a policy. Warning: If you send empty list of dictionaries during the update operation, then all the dictionaries for this policy are deleted and policy is automatically disabled. Note: The policy should already exist. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param body: (required) + :type body: V1DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_put_serialize( + session_token=session_token, + policy_id=policy_id, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_policies_policy_id_put_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + body: V1DLPPolicyRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Updates a policy. Cannot be used for creation. + + Update the policy (name, type, contentTypes, scopes) and also the dictionaries for a policy. Warning: If you send empty list of dictionaries during the update operation, then all the dictionaries for this policy are deleted and policy is automatically disabled. Note: The policy should already exist. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param body: (required) + :type body: V1DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_policy_id_put_serialize( + session_token=session_token, + policy_id=policy_id, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_policies_policy_id_put_serialize( self, session_token, policy_id, body, - **kwargs - ): - """Updates a policy. Cannot be used for creation. # noqa: E501 - - Update the policy (name, type, contentTypes, scopes) and also the dictionaries for a policy. Warning: If you send empty list of dictionaries during the update operation, then all the dictionaries for this policy are deleted and policy is automatically disabled. Note: The policy should already exist. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_policies_policy_id_put(session_token, policy_id, body, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - policy_id (str): Unique dictionary identifier. - body (V1DLPPolicyRequest): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['policy_id'] = \ - policy_id - kwargs['body'] = \ - body - return self.v1_dlp_policies_policy_id_put_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_policies_post( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if policy_id is not None: + _path_params['policyId'] = policy_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/dlp/policies/{policyId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_dlp_policies_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: Annotated[V1DLPPolicyRequest, Field(description="Details about the policy that should be created.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPPolicyResponse: + """Creates a policy + + Creates a new policy with dictionary references. At the time of policy creation, the caller should only provide - contentTypes, name, scopes and type. The rest of the information is populated automatically. Note - You need to enable the policy after creation to start enforcing the policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: Details about the policy that should be created. (required) + :type body: V1DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_post_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_policies_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: Annotated[V1DLPPolicyRequest, Field(description="Details about the policy that should be created.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPPolicyResponse]: + """Creates a policy + + Creates a new policy with dictionary references. At the time of policy creation, the caller should only provide - contentTypes, name, scopes and type. The rest of the information is populated automatically. Note - You need to enable the policy after creation to start enforcing the policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: Details about the policy that should be created. (required) + :type body: V1DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_post_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_dlp_policies_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: Annotated[V1DLPPolicyRequest, Field(description="Details about the policy that should be created.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Creates a policy + + Creates a new policy with dictionary references. At the time of policy creation, the caller should only provide - contentTypes, name, scopes and type. The rest of the information is populated automatically. Note - You need to enable the policy after creation to start enforcing the policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: Details about the policy that should be created. (required) + :type body: V1DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_policies_post_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_dlp_policies_post_serialize( self, session_token, body, - **kwargs - ): - """Creates a policy # noqa: E501 - - Creates a new policy with dictionary references. At the time of policy creation, the caller should only provide - contentTypes, name, scopes and type. The rest of the information is populated automatically. Note - You need to enable the policy after creation to start enforcing the policy. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_policies_post(session_token, body, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - body (V1DLPPolicyRequest): Details about the policy that should be created. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['body'] = \ - body - return self.v1_dlp_policies_post_endpoint.call_with_http_info(**kwargs) - - def v3_dlp_policies_get( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/dlp/policies', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_dlp_policies_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify which page to return (default is 0)")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3DLPPoliciesCollectionResponse: + """Get all policies + + Get all policies + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param page: Optional parameter to specify which page to return (default is 0) + :type page: int + :param limit: Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + page=page, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPoliciesCollectionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_dlp_policies_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify which page to return (default is 0)")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3DLPPoliciesCollectionResponse]: + """Get all policies + + Get all policies + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param page: Optional parameter to specify which page to return (default is 0) + :type page: int + :param limit: Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + page=page, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPoliciesCollectionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_dlp_policies_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + page: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify which page to return (default is 0)")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get all policies + + Get all policies + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param page: Optional parameter to specify which page to return (default is 0) + :type page: int + :param limit: Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + page=page, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPoliciesCollectionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_dlp_policies_get_serialize( self, session_token, - **kwargs - ): - """Get all policies # noqa: E501 - - Get all policies # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_dlp_policies_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - page (int): Optional parameter to specify which page to return (default is 0). [optional] - limit (int): Optional parameter to specify the number of result to return per page, default is 50. Maximum is 50. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3DLPPoliciesCollectionResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v3_dlp_policies_get_endpoint.call_with_http_info(**kwargs) - - def v3_dlp_policies_policy_id_delete_post( + key_manager_token, + page, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/dlp/policies', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_dlp_policies_policy_id_delete_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3DLPPolicyResponse: + """Delete a policy + + Delete a policy. Note: Only disabled policy can be deleted + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_delete_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_dlp_policies_policy_id_delete_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3DLPPolicyResponse]: + """Delete a policy + + Delete a policy. Note: Only disabled policy can be deleted + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_delete_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_dlp_policies_policy_id_delete_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a policy + + Delete a policy. Note: Only disabled policy can be deleted + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_delete_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_dlp_policies_policy_id_delete_post_serialize( self, session_token, policy_id, - **kwargs - ): - """Delete a policy # noqa: E501 - - Delete a policy. Note: Only disabled policy can be deleted # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_dlp_policies_policy_id_delete_post(session_token, policy_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - policy_id (str): Unique dictionary identifier. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['policy_id'] = \ - policy_id - return self.v3_dlp_policies_policy_id_delete_post_endpoint.call_with_http_info(**kwargs) - - def v3_dlp_policies_policy_id_disable_post( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if policy_id is not None: + _path_params['policyId'] = policy_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/dlp/policies/{policyId}/delete', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_dlp_policies_policy_id_disable_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3DLPPolicyResponse: + """Disables a policy. + + Disables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_disable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_dlp_policies_policy_id_disable_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3DLPPolicyResponse]: + """Disables a policy. + + Disables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_disable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_dlp_policies_policy_id_disable_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Disables a policy. + + Disables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_disable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_dlp_policies_policy_id_disable_post_serialize( self, session_token, policy_id, - **kwargs - ): - """Disables a policy. # noqa: E501 - - Disables a policy. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_dlp_policies_policy_id_disable_post(session_token, policy_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - policy_id (str): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['policy_id'] = \ - policy_id - return self.v3_dlp_policies_policy_id_disable_post_endpoint.call_with_http_info(**kwargs) - - def v3_dlp_policies_policy_id_enable_post( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if policy_id is not None: + _path_params['policyId'] = policy_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/dlp/policies/{policyId}/disable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_dlp_policies_policy_id_enable_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3DLPPolicyResponse: + """Enables a policy. + + Enables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_enable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_dlp_policies_policy_id_enable_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3DLPPolicyResponse]: + """Enables a policy. + + Enables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_enable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_dlp_policies_policy_id_enable_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: StrictStr, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Enables a policy. + + Enables a policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_enable_post_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_dlp_policies_policy_id_enable_post_serialize( self, session_token, policy_id, - **kwargs - ): - """Enables a policy. # noqa: E501 - - Enables a policy. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_dlp_policies_policy_id_enable_post(session_token, policy_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - policy_id (str): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['policy_id'] = \ - policy_id - return self.v3_dlp_policies_policy_id_enable_post_endpoint.call_with_http_info(**kwargs) - - def v3_dlp_policies_policy_id_get( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if policy_id is not None: + _path_params['policyId'] = policy_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/dlp/policies/{policyId}/enable', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_dlp_policies_policy_id_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + policy_version: Annotated[Optional[StrictStr], Field(description="Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3DLPPolicyResponse: + """Get a policy + + Get a policy + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param policy_version: Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. + :type policy_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_get_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + policy_version=policy_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_dlp_policies_policy_id_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + policy_version: Annotated[Optional[StrictStr], Field(description="Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3DLPPolicyResponse]: + """Get a policy + + Get a policy + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param policy_version: Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. + :type policy_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_get_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + policy_version=policy_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_dlp_policies_policy_id_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + policy_version: Annotated[Optional[StrictStr], Field(description="Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a policy + + Get a policy + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param policy_version: Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. + :type policy_version: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_get_serialize( + session_token=session_token, + policy_id=policy_id, + key_manager_token=key_manager_token, + policy_version=policy_version, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_dlp_policies_policy_id_get_serialize( self, session_token, policy_id, - **kwargs - ): - """Get a policy # noqa: E501 - - Get a policy # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_dlp_policies_policy_id_get(session_token, policy_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - policy_id (str): Unique dictionary identifier. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - policy_version (str): Optional parameter, if set to be valid policy version number, will return policy with specified policyVersion. Otherwise, return the latest policy. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['policy_id'] = \ - policy_id - return self.v3_dlp_policies_policy_id_get_endpoint.call_with_http_info(**kwargs) - - def v3_dlp_policies_policy_id_update_post( + key_manager_token, + policy_version, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if policy_id is not None: + _path_params['policyId'] = policy_id + # process the query parameters + if policy_version is not None: + + _query_params.append(('policyVersion', policy_version)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/dlp/policies/{policyId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_dlp_policies_policy_id_update_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + body: V3DLPPolicyRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3DLPPolicyResponse: + """Updates a policy. Cannot be used for creation. + + Update the policy (name, type, contentTypes, scopes) and also the dictionaries for a policy. Warning: If you send empty list of dictionaries during the update operation, then all the dictionaries for this policy are deleted and policy is automatically disabled. Note: The policy should already exist. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param body: (required) + :type body: V3DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_update_post_serialize( + session_token=session_token, + policy_id=policy_id, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_dlp_policies_policy_id_update_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + body: V3DLPPolicyRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3DLPPolicyResponse]: + """Updates a policy. Cannot be used for creation. + + Update the policy (name, type, contentTypes, scopes) and also the dictionaries for a policy. Warning: If you send empty list of dictionaries during the update operation, then all the dictionaries for this policy are deleted and policy is automatically disabled. Note: The policy should already exist. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param body: (required) + :type body: V3DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_update_post_serialize( + session_token=session_token, + policy_id=policy_id, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_dlp_policies_policy_id_update_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + policy_id: Annotated[StrictStr, Field(description="Unique dictionary identifier.")], + body: V3DLPPolicyRequest, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Updates a policy. Cannot be used for creation. + + Update the policy (name, type, contentTypes, scopes) and also the dictionaries for a policy. Warning: If you send empty list of dictionaries during the update operation, then all the dictionaries for this policy are deleted and policy is automatically disabled. Note: The policy should already exist. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param policy_id: Unique dictionary identifier. (required) + :type policy_id: str + :param body: (required) + :type body: V3DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_policy_id_update_post_serialize( + session_token=session_token, + policy_id=policy_id, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_dlp_policies_policy_id_update_post_serialize( self, session_token, policy_id, body, - **kwargs - ): - """Updates a policy. Cannot be used for creation. # noqa: E501 - - Update the policy (name, type, contentTypes, scopes) and also the dictionaries for a policy. Warning: If you send empty list of dictionaries during the update operation, then all the dictionaries for this policy are deleted and policy is automatically disabled. Note: The policy should already exist. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_dlp_policies_policy_id_update_post(session_token, policy_id, body, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - policy_id (str): Unique dictionary identifier. - body (V3DLPPolicyRequest): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['policy_id'] = \ - policy_id - kwargs['body'] = \ - body - return self.v3_dlp_policies_policy_id_update_post_endpoint.call_with_http_info(**kwargs) - - def v3_dlp_policies_post( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if policy_id is not None: + _path_params['policyId'] = policy_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/dlp/policies/{policyId}/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_dlp_policies_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: Annotated[V3DLPPolicyRequest, Field(description="Details about the policy that should be created.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3DLPPolicyResponse: + """Creates a policy + + Creates a new policy with dictionary references. At the time of policy creation, the caller should only provide - contentTypes, name, scopes and type. The rest of the information is populated automatically. Note - You need to enable the policy after creation to start enforcing the policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: Details about the policy that should be created. (required) + :type body: V3DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_post_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_dlp_policies_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: Annotated[V3DLPPolicyRequest, Field(description="Details about the policy that should be created.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3DLPPolicyResponse]: + """Creates a policy + + Creates a new policy with dictionary references. At the time of policy creation, the caller should only provide - contentTypes, name, scopes and type. The rest of the information is populated automatically. Note - You need to enable the policy after creation to start enforcing the policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: Details about the policy that should be created. (required) + :type body: V3DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_post_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_dlp_policies_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + body: Annotated[V3DLPPolicyRequest, Field(description="Details about the policy that should be created.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Creates a policy + + Creates a new policy with dictionary references. At the time of policy creation, the caller should only provide - contentTypes, name, scopes and type. The rest of the information is populated automatically. Note - You need to enable the policy after creation to start enforcing the policy. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param body: Details about the policy that should be created. (required) + :type body: V3DLPPolicyRequest + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_policies_post_serialize( + session_token=session_token, + body=body, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPPolicyResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_dlp_policies_post_serialize( self, session_token, body, - **kwargs - ): - """Creates a policy # noqa: E501 - - Creates a new policy with dictionary references. At the time of policy creation, the caller should only provide - contentTypes, name, scopes and type. The rest of the information is populated automatically. Note - You need to enable the policy after creation to start enforcing the policy. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_dlp_policies_post(session_token, body, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - body (V3DLPPolicyRequest): Details about the policy that should be created. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3DLPPolicyResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['body'] = \ - body - return self.v3_dlp_policies_post_endpoint.call_with_http_info(**kwargs) + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/dlp/policies', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/agent_api/messages_api.py b/symphony/bdk/gen/agent_api/messages_api.py index 64829e3c..6eace0f5 100644 --- a/symphony/bdk/gen/agent_api/messages_api.py +++ b/symphony/bdk/gen/agent_api/messages_api.py @@ -1,2475 +1,5386 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.agent_model.error import Error -from symphony.bdk.gen.agent_model.import_response_list import ImportResponseList +from pydantic import Field, StrictBytes, StrictInt, StrictStr +from typing import List, Optional, Tuple, Union +from typing_extensions import Annotated +from symphony.bdk.gen.agent_model.import_response import ImportResponse +from symphony.bdk.gen.agent_model.imported_message import ImportedMessage from symphony.bdk.gen.agent_model.message import Message -from symphony.bdk.gen.agent_model.message_import_list import MessageImportList -from symphony.bdk.gen.agent_model.message_list import MessageList from symphony.bdk.gen.agent_model.message_search_query import MessageSearchQuery from symphony.bdk.gen.agent_model.message_submission import MessageSubmission -from symphony.bdk.gen.agent_model.v2_error import V2Error -from symphony.bdk.gen.agent_model.v2_import_response_list import V2ImportResponseList +from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage +from symphony.bdk.gen.agent_model.v2_import_response import V2ImportResponse +from symphony.bdk.gen.agent_model.v2_imported_message import V2ImportedMessage from symphony.bdk.gen.agent_model.v2_message import V2Message -from symphony.bdk.gen.agent_model.v2_message_import_list import V2MessageImportList -from symphony.bdk.gen.agent_model.v2_message_list import V2MessageList from symphony.bdk.gen.agent_model.v2_message_submission import V2MessageSubmission -from symphony.bdk.gen.agent_model.v4_import_response_list import V4ImportResponseList +from symphony.bdk.gen.agent_model.v4_import_response import V4ImportResponse +from symphony.bdk.gen.agent_model.v4_imported_message import V4ImportedMessage from symphony.bdk.gen.agent_model.v4_message import V4Message from symphony.bdk.gen.agent_model.v4_message_blast_response import V4MessageBlastResponse -from symphony.bdk.gen.agent_model.v4_message_import_list import V4MessageImportList -from symphony.bdk.gen.agent_model.v4_message_list import V4MessageList +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class MessagesApi(object): + +class MessagesApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_message_id_get_endpoint = _Endpoint( - settings={ - 'response_type': (V4Message,), - 'auth': [], - 'endpoint_path': '/v1/message/{id}', - 'operation_id': 'v1_message_id_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'id', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'id': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'id': 'id', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'id': 'path', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_message_import_post_endpoint = _Endpoint( - settings={ - 'response_type': (ImportResponseList,), - 'auth': [], - 'endpoint_path': '/v1/message/import', - 'operation_id': 'v1_message_import_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'message_list', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'message_list', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'message_list': - (MessageImportList,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'message_list': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_message_search_get_endpoint = _Endpoint( - settings={ - 'response_type': (V4MessageList,), - 'auth': [], - 'endpoint_path': '/v1/message/search', - 'operation_id': 'v1_message_search_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'query', - 'session_token', - 'skip', - 'limit', - 'scope', - 'sort_dir', - 'tier', - 'key_manager_token', - ], - 'required': [ - 'query', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'query': - (str,), - 'session_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - 'scope': - (str,), - 'sort_dir': - (str,), - 'tier': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'query': 'query', - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - 'scope': 'scope', - 'sort_dir': 'sortDir', - 'tier': 'tier', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'query': 'query', - 'session_token': 'header', - 'skip': 'query', - 'limit': 'query', - 'scope': 'query', - 'sort_dir': 'query', - 'tier': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_message_search_post_endpoint = _Endpoint( - settings={ - 'response_type': (V4MessageList,), - 'auth': [], - 'endpoint_path': '/v1/message/search', - 'operation_id': 'v1_message_search_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'query', - 'skip', - 'limit', - 'scope', - 'sort_dir', - 'tier', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'query', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'query': - (MessageSearchQuery,), - 'skip': - (int,), - 'limit': - (int,), - 'scope': - (str,), - 'sort_dir': - (str,), - 'tier': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - 'scope': 'scope', - 'sort_dir': 'sortDir', - 'tier': 'tier', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'query': 'body', - 'skip': 'query', - 'limit': 'query', - 'scope': 'query', - 'sort_dir': 'query', - 'tier': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_stream_sid_message_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (Message,), - 'auth': [], - 'endpoint_path': '/v1/stream/{sid}/message/create', - 'operation_id': 'v1_stream_sid_message_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'session_token', - 'message', - 'key_manager_token', - ], - 'required': [ - 'sid', - 'session_token', - 'message', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'session_token': - (str,), - 'message': - (MessageSubmission,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'sid': 'path', - 'session_token': 'header', - 'message': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_stream_sid_message_get_endpoint = _Endpoint( - settings={ - 'response_type': (MessageList,), - 'auth': [], - 'endpoint_path': '/v1/stream/{sid}/message', - 'operation_id': 'v1_stream_sid_message_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'since', - 'session_token', - 'offset', - 'max_messages', - 'key_manager_token', - ], - 'required': [ - 'sid', - 'since', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'since': - (int,), - 'session_token': - (str,), - 'offset': - (int,), - 'max_messages': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'since': 'since', - 'session_token': 'sessionToken', - 'offset': 'offset', - 'max_messages': 'maxMessages', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'sid': 'path', - 'since': 'query', - 'session_token': 'header', - 'offset': 'query', - 'max_messages': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v2_message_import_post_endpoint = _Endpoint( - settings={ - 'response_type': (V2ImportResponseList,), - 'auth': [], - 'endpoint_path': '/v2/message/import', - 'operation_id': 'v2_message_import_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'message_list', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'message_list', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'message_list': - (V2MessageImportList,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'message_list': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v2_stream_sid_message_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (V2Message,), - 'auth': [], - 'endpoint_path': '/v2/stream/{sid}/message/create', - 'operation_id': 'v2_stream_sid_message_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'session_token', - 'message', - 'key_manager_token', - ], - 'required': [ - 'sid', - 'session_token', - 'message', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'session_token': - (str,), - 'message': - (V2MessageSubmission,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'sid': 'path', - 'session_token': 'header', - 'message': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v2_stream_sid_message_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2MessageList,), - 'auth': [], - 'endpoint_path': '/v2/stream/{sid}/message', - 'operation_id': 'v2_stream_sid_message_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'since', - 'session_token', - 'offset', - 'limit', - 'key_manager_token', - ], - 'required': [ - 'sid', - 'since', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'since': - (int,), - 'session_token': - (str,), - 'offset': - (int,), - 'limit': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'since': 'since', - 'session_token': 'sessionToken', - 'offset': 'offset', - 'limit': 'limit', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'sid': 'path', - 'since': 'query', - 'session_token': 'header', - 'offset': 'query', - 'limit': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_stream_sid_message_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (V2Message,), - 'auth': [], - 'endpoint_path': '/v3/stream/{sid}/message/create', - 'operation_id': 'v3_stream_sid_message_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'session_token', - 'message', - 'key_manager_token', - ], - 'required': [ - 'sid', - 'session_token', - 'message', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'session_token': - (str,), - 'message': - (V2MessageSubmission,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'sid': 'path', - 'session_token': 'header', - 'message': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v4_message_blast_post_endpoint = _Endpoint( - settings={ - 'response_type': (V4MessageBlastResponse,), - 'auth': [], - 'endpoint_path': '/v4/message/blast', - 'operation_id': 'v4_message_blast_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'sids', - 'key_manager_token', - 'message', - 'data', - 'version', - 'attachment', - 'preview', - ], - 'required': [ - 'session_token', - 'sids', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'sids': - ([str],), - 'key_manager_token': - (str,), - 'message': - (str,), - 'data': - (str,), - 'version': - (str,), - 'attachment': - (file_type,), - 'preview': - (file_type,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'sids': 'sids', - 'key_manager_token': 'keyManagerToken', - 'message': 'message', - 'data': 'data', - 'version': 'version', - 'attachment': 'attachment', - 'preview': 'preview', - }, - 'location_map': { - 'session_token': 'header', - 'sids': 'form', - 'key_manager_token': 'header', - 'message': 'form', - 'data': 'form', - 'version': 'form', - 'attachment': 'form', - 'preview': 'form', - }, - 'collection_format_map': { - 'sids': 'csv', - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'multipart/form-data' - ] - }, - api_client=api_client - ) - self.v4_message_import_post_endpoint = _Endpoint( - settings={ - 'response_type': (V4ImportResponseList,), - 'auth': [], - 'endpoint_path': '/v4/message/import', - 'operation_id': 'v4_message_import_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'message_list', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'message_list', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'message_list': - (V4MessageImportList,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'message_list': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v4_stream_sid_message_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (V4Message,), - 'auth': [], - 'endpoint_path': '/v4/stream/{sid}/message/create', - 'operation_id': 'v4_stream_sid_message_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'session_token', - 'key_manager_token', - 'message', - 'data', - 'version', - 'attachment', - 'preview', - ], - 'required': [ - 'sid', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'session_token': - (str,), - 'key_manager_token': - (str,), - 'message': - (str,), - 'data': - (str,), - 'version': - (str,), - 'attachment': - (file_type,), - 'preview': - (file_type,), - }, - 'attribute_map': { - 'sid': 'sid', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - 'message': 'message', - 'data': 'data', - 'version': 'version', - 'attachment': 'attachment', - 'preview': 'preview', - }, - 'location_map': { - 'sid': 'path', - 'session_token': 'header', - 'key_manager_token': 'header', - 'message': 'form', - 'data': 'form', - 'version': 'form', - 'attachment': 'form', - 'preview': 'form', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'multipart/form-data' - ] - }, - api_client=api_client - ) - self.v4_stream_sid_message_get_endpoint = _Endpoint( - settings={ - 'response_type': (V4MessageList,), - 'auth': [], - 'endpoint_path': '/v4/stream/{sid}/message', - 'operation_id': 'v4_stream_sid_message_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'since', - 'session_token', - 'skip', - 'limit', - 'key_manager_token', - ], - 'required': [ - 'sid', - 'since', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'since': - (int,), - 'session_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'since': 'since', - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'sid': 'path', - 'since': 'query', - 'session_token': 'header', - 'skip': 'query', - 'limit': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v4_stream_sid_message_mid_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (V4Message,), - 'auth': [], - 'endpoint_path': '/v4/stream/{sid}/message/{mid}/update', - 'operation_id': 'v4_stream_sid_message_mid_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'mid', - 'session_token', - 'key_manager_token', - 'message', - 'data', - 'version', - 'attachment', - 'preview', - 'silent', - ], - 'required': [ - 'sid', - 'mid', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'mid': - (str,), - 'session_token': - (str,), - 'key_manager_token': - (str,), - 'message': - (str,), - 'data': - (str,), - 'version': - (str,), - 'attachment': - (file_type,), - 'preview': - (file_type,), - 'silent': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'mid': 'mid', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - 'message': 'message', - 'data': 'data', - 'version': 'version', - 'attachment': 'attachment', - 'preview': 'preview', - 'silent': 'silent', - }, - 'location_map': { - 'sid': 'path', - 'mid': 'path', - 'session_token': 'header', - 'key_manager_token': 'header', - 'message': 'form', - 'data': 'form', - 'version': 'form', - 'attachment': 'form', - 'preview': 'form', - 'silent': 'form', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'multipart/form-data' - ] - }, - api_client=api_client + + + @validate_call + async def v1_message_id_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="Message ID as a URL-safe string")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V4Message: + """Get a message by ID + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: Message ID as a URL-safe string (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_id_get_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4Message", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - def v1_message_id_get( + + @validate_call + async def v1_message_id_get_with_http_info( self, - session_token, - id, - **kwargs - ): - """Get a message by ID # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_message_id_get(session_token, id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - id (str): Message ID as a URL-safe string - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V4Message - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['id'] = \ - id - return self.v1_message_id_get_endpoint.call_with_http_info(**kwargs) - - def v1_message_import_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="Message ID as a URL-safe string")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V4Message]: + """Get a message by ID + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: Message ID as a URL-safe string (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_id_get_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4Message", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_message_id_get_without_preload_content( self, - session_token, - message_list, - **kwargs - ): - """Import messages from other systems into Symphony. # noqa: E501 - - Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_message_import_post(session_token, message_list, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - message_list (MessageImportList): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ImportResponseList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['message_list'] = \ - message_list - return self.v1_message_import_post_endpoint.call_with_http_info(**kwargs) - - def v1_message_search_get( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="Message ID as a URL-safe string")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a message by ID + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: Message ID as a URL-safe string (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_id_get_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4Message", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_message_id_get_serialize( self, - query, session_token, - **kwargs - ): - """Search messages # noqa: E501 - - Search messages according to the specified criteria. The \"query\" parameter takes a search query defined as \"field:value\" pairs combined by the operator \"AND\" (e.g. \"text:foo AND autor:bar\"). Supported fields are (case-insensitive): \"text\", \"author\", \"hashtag\", \"cashtag\", \"mention\", \"signal\", \"fromDate\", \"toDate\", \"streamId\", \"streamType\". \"text\" search requires a \"streamId\" to be specified. \"streamType\" accepts one of the following values: \"chat\" (IMs and MIMs), \"im\", \"mim\", \"chatroom\", \"post\". \"signal\" queries can only be combined with \"fromDate\", \"toDate\", \"skip\" and \"limit\" parameters. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_message_search_get(query, session_token, async_req=True) - >>> result = thread.get() - - Args: - query (str): The search query. See above for the query syntax. - session_token (str): Session authentication token. - - Keyword Args: - skip (int): No. of results to skip.. [optional] - limit (int): Max no. of results to return. If no value is provided, 50 is the default.. [optional] - scope (str): Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. . [optional] - sort_dir (str): Messages sort direction : ASC or DESC (default to DESC) . [optional] - tier (str): Target search tier : hot, warm or all (default to hot) . [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V4MessageList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['query'] = \ - query - kwargs['session_token'] = \ - session_token - return self.v1_message_search_get_endpoint.call_with_http_info(**kwargs) - - def v1_message_search_post( + id, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/message/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_message_import_post( self, - session_token, - query, - **kwargs - ): - """Search messages # noqa: E501 - - Search messages according to the specified criteria. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_message_search_post(session_token, query, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - query (MessageSearchQuery): The search query. See above for the query syntax. - - Keyword Args: - skip (int): No. of results to skip.. [optional] - limit (int): Max no. of results to return. If no value is provided, 50 is the default.. [optional] - scope (str): Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. . [optional] - sort_dir (str): Messages sort direction : ASC or DESC (default to DESC) . [optional] - tier (str): Target search tier : hot, warm or all (default to hot) . [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V4MessageList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['query'] = \ - query - return self.v1_message_search_post_endpoint.call_with_http_info(**kwargs) - - def v1_stream_sid_message_create_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_list: List[ImportedMessage], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[ImportResponse]: + """(Deprecated) Import messages from other systems into Symphony. + + Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_list: (required) + :type message_list: List[ImportedMessage] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/message/import is deprecated.", DeprecationWarning) + + _param = self._v1_message_import_post_serialize( + session_token=session_token, + message_list=message_list, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ImportResponse]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_message_import_post_with_http_info( self, - sid, - session_token, - message, - **kwargs - ): - """Post a message to one existing stream. # noqa: E501 - - Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_stream_sid_message_create_post(sid, session_token, message, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - session_token (str): Session authentication token. - message (MessageSubmission): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Message - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['session_token'] = \ - session_token - kwargs['message'] = \ - message - return self.v1_stream_sid_message_create_post_endpoint.call_with_http_info(**kwargs) - - def v1_stream_sid_message_get( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_list: List[ImportedMessage], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[ImportResponse]]: + """(Deprecated) Import messages from other systems into Symphony. + + Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_list: (required) + :type message_list: List[ImportedMessage] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/message/import is deprecated.", DeprecationWarning) + + _param = self._v1_message_import_post_serialize( + session_token=session_token, + message_list=message_list, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ImportResponse]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_message_import_post_without_preload_content( self, - sid, - since, - session_token, - **kwargs - ): - """Get messages from an existing stream. # noqa: E501 - - A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_stream_sid_message_get(sid, since, session_token, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - since (int): Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 - session_token (str): Session authentication token. - - Keyword Args: - offset (int): No. of messages to skip.. [optional] - max_messages (int): Max No. of messages to return. If no value is provided, 50 is the default.. [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - MessageList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['since'] = \ - since - kwargs['session_token'] = \ - session_token - return self.v1_stream_sid_message_get_endpoint.call_with_http_info(**kwargs) - - def v2_message_import_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_list: List[ImportedMessage], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Import messages from other systems into Symphony. + + Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_list: (required) + :type message_list: List[ImportedMessage] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/message/import is deprecated.", DeprecationWarning) + + _param = self._v1_message_import_post_serialize( + session_token=session_token, + message_list=message_list, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[ImportResponse]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_message_import_post_serialize( self, session_token, message_list, - **kwargs - ): - """Import messages from other systems into Symphony. # noqa: E501 - - Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. Optionally the original message ID can be specified to identify the imported message for the purpose of repeat imports. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v2_message_import_post(session_token, message_list, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - message_list (V2MessageImportList): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2ImportResponseList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['message_list'] = \ - message_list - return self.v2_message_import_post_endpoint.call_with_http_info(**kwargs) - - def v2_stream_sid_message_create_post( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'messageList': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if message_list is not None: + _body_params = message_list + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/message/import', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_message_search_get( self, - sid, - session_token, - message, - **kwargs - ): - """Post a message to one existing stream. # noqa: E501 - - Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message (see the V2MessageSubmission parameter). If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v2_stream_sid_message_create_post(sid, session_token, message, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - session_token (str): Session authentication token. - message (V2MessageSubmission): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2Message - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['session_token'] = \ - session_token - kwargs['message'] = \ - message - return self.v2_stream_sid_message_create_post_endpoint.call_with_http_info(**kwargs) - - def v2_stream_sid_message_get( + query: Annotated[StrictStr, Field(description="The search query. See above for the query syntax.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default.")] = None, + scope: Annotated[Optional[StrictStr], Field(description="Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. ")] = None, + sort_dir: Annotated[Optional[StrictStr], Field(description="Messages sort direction : ASC or DESC (default to DESC) ")] = None, + tier: Annotated[Optional[StrictStr], Field(description="Target search tier : hot, warm or all (default to hot) ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V4Message]: + """Search messages + + Search messages according to the specified criteria. The \"query\" parameter takes a search query defined as \"field:value\" pairs combined by the operator \"AND\" (e.g. \"text:foo AND autor:bar\"). Supported fields are (case-insensitive): \"text\", \"author\", \"hashtag\", \"cashtag\", \"mention\", \"signal\", \"fromDate\", \"toDate\", \"streamId\", \"streamType\". \"text\" search requires a \"streamId\" to be specified. \"streamType\" accepts one of the following values: \"chat\" (IMs and MIMs), \"im\", \"mim\", \"chatroom\", \"post\". \"signal\" queries can only be combined with \"fromDate\", \"toDate\", \"skip\" and \"limit\" parameters. + + :param query: The search query. See above for the query syntax. (required) + :type query: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param scope: Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. + :type scope: str + :param sort_dir: Messages sort direction : ASC or DESC (default to DESC) + :type sort_dir: str + :param tier: Target search tier : hot, warm or all (default to hot) + :type tier: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_search_get_serialize( + query=query, + session_token=session_token, + skip=skip, + limit=limit, + scope=scope, + sort_dir=sort_dir, + tier=tier, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Message]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_message_search_get_with_http_info( self, - sid, - since, - session_token, - **kwargs - ): - """Get messages from an existing stream. # noqa: E501 - - A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v2_stream_sid_message_get(sid, since, session_token, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - since (int): Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 - session_token (str): Session authentication token. - - Keyword Args: - offset (int): No. of messages to skip.. [optional] - limit (int): Max No. of messages to return. If no value is provided, 50 is the default.. [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2MessageList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['since'] = \ - since - kwargs['session_token'] = \ - session_token - return self.v2_stream_sid_message_get_endpoint.call_with_http_info(**kwargs) - - def v3_stream_sid_message_create_post( + query: Annotated[StrictStr, Field(description="The search query. See above for the query syntax.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default.")] = None, + scope: Annotated[Optional[StrictStr], Field(description="Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. ")] = None, + sort_dir: Annotated[Optional[StrictStr], Field(description="Messages sort direction : ASC or DESC (default to DESC) ")] = None, + tier: Annotated[Optional[StrictStr], Field(description="Target search tier : hot, warm or all (default to hot) ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V4Message]]: + """Search messages + + Search messages according to the specified criteria. The \"query\" parameter takes a search query defined as \"field:value\" pairs combined by the operator \"AND\" (e.g. \"text:foo AND autor:bar\"). Supported fields are (case-insensitive): \"text\", \"author\", \"hashtag\", \"cashtag\", \"mention\", \"signal\", \"fromDate\", \"toDate\", \"streamId\", \"streamType\". \"text\" search requires a \"streamId\" to be specified. \"streamType\" accepts one of the following values: \"chat\" (IMs and MIMs), \"im\", \"mim\", \"chatroom\", \"post\". \"signal\" queries can only be combined with \"fromDate\", \"toDate\", \"skip\" and \"limit\" parameters. + + :param query: The search query. See above for the query syntax. (required) + :type query: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param scope: Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. + :type scope: str + :param sort_dir: Messages sort direction : ASC or DESC (default to DESC) + :type sort_dir: str + :param tier: Target search tier : hot, warm or all (default to hot) + :type tier: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_search_get_serialize( + query=query, + session_token=session_token, + skip=skip, + limit=limit, + scope=scope, + sort_dir=sort_dir, + tier=tier, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Message]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_message_search_get_without_preload_content( self, - sid, - session_token, - message, - **kwargs - ): - """PROVISIONAL - Post a message to one existing stream. # noqa: E501 - - Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message (see the V2MessageSubmission parameter). If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_stream_sid_message_create_post(sid, session_token, message, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - session_token (str): Authorization token used to make delegated calls. - message (V2MessageSubmission): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2Message - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['session_token'] = \ - session_token - kwargs['message'] = \ - message - return self.v3_stream_sid_message_create_post_endpoint.call_with_http_info(**kwargs) - - def v4_message_blast_post( + query: Annotated[StrictStr, Field(description="The search query. See above for the query syntax.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default.")] = None, + scope: Annotated[Optional[StrictStr], Field(description="Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. ")] = None, + sort_dir: Annotated[Optional[StrictStr], Field(description="Messages sort direction : ASC or DESC (default to DESC) ")] = None, + tier: Annotated[Optional[StrictStr], Field(description="Target search tier : hot, warm or all (default to hot) ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Search messages + + Search messages according to the specified criteria. The \"query\" parameter takes a search query defined as \"field:value\" pairs combined by the operator \"AND\" (e.g. \"text:foo AND autor:bar\"). Supported fields are (case-insensitive): \"text\", \"author\", \"hashtag\", \"cashtag\", \"mention\", \"signal\", \"fromDate\", \"toDate\", \"streamId\", \"streamType\". \"text\" search requires a \"streamId\" to be specified. \"streamType\" accepts one of the following values: \"chat\" (IMs and MIMs), \"im\", \"mim\", \"chatroom\", \"post\". \"signal\" queries can only be combined with \"fromDate\", \"toDate\", \"skip\" and \"limit\" parameters. + + :param query: The search query. See above for the query syntax. (required) + :type query: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param scope: Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. + :type scope: str + :param sort_dir: Messages sort direction : ASC or DESC (default to DESC) + :type sort_dir: str + :param tier: Target search tier : hot, warm or all (default to hot) + :type tier: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_search_get_serialize( + query=query, + session_token=session_token, + skip=skip, + limit=limit, + scope=scope, + sort_dir=sort_dir, + tier=tier, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Message]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_message_search_get_serialize( self, + query, session_token, - sids, - **kwargs - ): - """Post a message to multiple existing streams. # noqa: E501 - - Post a new message to the given list of streams. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. If the message is in MessageML and fails schema validation a client error results This endpoint is idempotent, it means that a 200 response will be returned even if the message has not been delivered to some streams. Check the `errors` map from the response in order to see on which stream(s) the message has not been delivered. The maximum number of streams where the message can be sent is limitted to 100. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v4_message_blast_post(session_token, sids, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Authorization token used to make delegated calls. - sids ([str]): A comma-separated list of Stream IDs - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - message (str): The message payload in MessageML.. [optional] - data (str): Optional message data in EntityJSON.. [optional] - version (str): Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. . [optional] - attachment (file_type): Optional file attachment.. [optional] - preview (file_type): Optional attachment preview.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V4MessageBlastResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['sids'] = \ - sids - return self.v4_message_blast_post_endpoint.call_with_http_info(**kwargs) - - def v4_message_import_post( + skip, + limit, + scope, + sort_dir, + tier, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if query is not None: + + _query_params.append(('query', query)) + + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if scope is not None: + + _query_params.append(('scope', scope)) + + if sort_dir is not None: + + _query_params.append(('sortDir', sort_dir)) + + if tier is not None: + + _query_params.append(('tier', tier)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/message/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_message_search_post( self, - session_token, - message_list, - **kwargs - ): - """Import messages from other systems into Symphony. # noqa: E501 - - Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. Optionally the original message ID can be specified to identify the imported message for the purpose of repeat imports. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v4_message_import_post(session_token, message_list, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - message_list (V4MessageImportList): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V4ImportResponseList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['message_list'] = \ - message_list - return self.v4_message_import_post_endpoint.call_with_http_info(**kwargs) - - def v4_stream_sid_message_create_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + query: Annotated[MessageSearchQuery, Field(description="The search query. See above for the query syntax.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default.")] = None, + scope: Annotated[Optional[StrictStr], Field(description="Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. ")] = None, + sort_dir: Annotated[Optional[StrictStr], Field(description="Messages sort direction : ASC or DESC (default to DESC) ")] = None, + tier: Annotated[Optional[StrictStr], Field(description="Target search tier : hot, warm or all (default to hot) ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V4Message]: + """Search messages + + Search messages according to the specified criteria. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param query: The search query. See above for the query syntax. (required) + :type query: MessageSearchQuery + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param scope: Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. + :type scope: str + :param sort_dir: Messages sort direction : ASC or DESC (default to DESC) + :type sort_dir: str + :param tier: Target search tier : hot, warm or all (default to hot) + :type tier: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_search_post_serialize( + session_token=session_token, + query=query, + skip=skip, + limit=limit, + scope=scope, + sort_dir=sort_dir, + tier=tier, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Message]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_message_search_post_with_http_info( self, - sid, - session_token, - **kwargs - ): - """Post a message to one existing stream. # noqa: E501 - - Post a new message to the given stream. The stream can be a chatroom,,an IM or a multiparty IM. You may include an attachment on the message. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. If the message is in MessageML and fails schema validation a client error will be returned. If the message is sent then 200 is returned. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v4_stream_sid_message_create_post(sid, session_token, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - session_token (str): Authorization token used to make delegated calls. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - message (str): The message payload in MessageML.. [optional] - data (str): Optional message data in EntityJSON.. [optional] - version (str): Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. . [optional] - attachment (file_type): Optional file attachment.. [optional] - preview (file_type): Optional attachment preview.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V4Message - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['session_token'] = \ - session_token - return self.v4_stream_sid_message_create_post_endpoint.call_with_http_info(**kwargs) - - def v4_stream_sid_message_get( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + query: Annotated[MessageSearchQuery, Field(description="The search query. See above for the query syntax.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default.")] = None, + scope: Annotated[Optional[StrictStr], Field(description="Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. ")] = None, + sort_dir: Annotated[Optional[StrictStr], Field(description="Messages sort direction : ASC or DESC (default to DESC) ")] = None, + tier: Annotated[Optional[StrictStr], Field(description="Target search tier : hot, warm or all (default to hot) ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V4Message]]: + """Search messages + + Search messages according to the specified criteria. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param query: The search query. See above for the query syntax. (required) + :type query: MessageSearchQuery + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param scope: Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. + :type scope: str + :param sort_dir: Messages sort direction : ASC or DESC (default to DESC) + :type sort_dir: str + :param tier: Target search tier : hot, warm or all (default to hot) + :type tier: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_search_post_serialize( + session_token=session_token, + query=query, + skip=skip, + limit=limit, + scope=scope, + sort_dir=sort_dir, + tier=tier, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Message]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_message_search_post_without_preload_content( self, - sid, - since, - session_token, - **kwargs - ): - """Get messages from an existing stream. # noqa: E501 - - A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v4_stream_sid_message_get(sid, since, session_token, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - since (int): Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 - session_token (str): Session authentication token. - - Keyword Args: - skip (int): No. of messages to skip.. [optional] - limit (int): Max No. of messages to return. If no value is provided, 50 is the default. The maximum supported value is 500. . [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V4MessageList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['since'] = \ - since - kwargs['session_token'] = \ - session_token - return self.v4_stream_sid_message_get_endpoint.call_with_http_info(**kwargs) - - def v4_stream_sid_message_mid_update_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + query: Annotated[MessageSearchQuery, Field(description="The search query. See above for the query syntax.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default.")] = None, + scope: Annotated[Optional[StrictStr], Field(description="Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. ")] = None, + sort_dir: Annotated[Optional[StrictStr], Field(description="Messages sort direction : ASC or DESC (default to DESC) ")] = None, + tier: Annotated[Optional[StrictStr], Field(description="Target search tier : hot, warm or all (default to hot) ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Search messages + + Search messages according to the specified criteria. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param query: The search query. See above for the query syntax. (required) + :type query: MessageSearchQuery + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param scope: Describes where content should be searched for that query. It can exclusively apply to Symphony content or to one Connector. + :type scope: str + :param sort_dir: Messages sort direction : ASC or DESC (default to DESC) + :type sort_dir: str + :param tier: Target search tier : hot, warm or all (default to hot) + :type tier: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_search_post_serialize( + session_token=session_token, + query=query, + skip=skip, + limit=limit, + scope=scope, + sort_dir=sort_dir, + tier=tier, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Message]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_message_search_post_serialize( self, - sid, - mid, session_token, - **kwargs - ): - """Update an existing message. # noqa: E501 - - Update an existing message. The existing message must be a valid social message, that has not been deleted. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. Starting with SBE v24.1, attachments are supported. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v4_stream_sid_message_mid_update_post(sid, mid, session_token, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - mid (str): ID of the message to be updated - session_token (str): Authorization token used to make delegated calls. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - message (str): The message payload in MessageML.. [optional] - data (str): Optional message data in EntityJSON.. [optional] - version (str): Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. . [optional] - attachment (file_type): Optional file attachment.. [optional] - preview (file_type): Optional attachment preview.. [optional] - silent (str): Optional boolean field that will determine if the user/s should receive the message as read or not (true by default) . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V4Message - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['mid'] = \ - mid - kwargs['session_token'] = \ - session_token - return self.v4_stream_sid_message_mid_update_post_endpoint.call_with_http_info(**kwargs) + query, + skip, + limit, + scope, + sort_dir, + tier, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if scope is not None: + + _query_params.append(('scope', scope)) + + if sort_dir is not None: + + _query_params.append(('sortDir', sort_dir)) + + if tier is not None: + + _query_params.append(('tier', tier)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if query is not None: + _body_params = query + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/message/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_stream_sid_message_create_post( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message: MessageSubmission, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Message: + """(Deprecated) Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param message: (required) + :type message: MessageSubmission + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/stream/{sid}/message/create is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + message=message, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_stream_sid_message_create_post_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message: MessageSubmission, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Message]: + """(Deprecated) Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param message: (required) + :type message: MessageSubmission + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/stream/{sid}/message/create is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + message=message, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_stream_sid_message_create_post_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message: MessageSubmission, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param message: (required) + :type message: MessageSubmission + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/stream/{sid}/message/create is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + message=message, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_stream_sid_message_create_post_serialize( + self, + sid, + session_token, + message, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if message is not None: + _body_params = message + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/stream/{sid}/message/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_stream_sid_message_get( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + since: Annotated[StrictInt, Field(description="Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + offset: Annotated[Optional[StrictInt], Field(description="No. of messages to skip.")] = None, + max_messages: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return. If no value is provided, 50 is the default.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[Message]: + """(Deprecated) Get messages from an existing stream. + + A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. + + :param sid: Stream ID (required) + :type sid: str + :param since: Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type since: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param offset: No. of messages to skip. + :type offset: int + :param max_messages: Max No. of messages to return. If no value is provided, 50 is the default. + :type max_messages: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v1/stream/{sid}/message is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_message_get_serialize( + sid=sid, + since=since, + session_token=session_token, + offset=offset, + max_messages=max_messages, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Message]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_stream_sid_message_get_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + since: Annotated[StrictInt, Field(description="Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + offset: Annotated[Optional[StrictInt], Field(description="No. of messages to skip.")] = None, + max_messages: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return. If no value is provided, 50 is the default.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[Message]]: + """(Deprecated) Get messages from an existing stream. + + A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. + + :param sid: Stream ID (required) + :type sid: str + :param since: Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type since: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param offset: No. of messages to skip. + :type offset: int + :param max_messages: Max No. of messages to return. If no value is provided, 50 is the default. + :type max_messages: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v1/stream/{sid}/message is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_message_get_serialize( + sid=sid, + since=since, + session_token=session_token, + offset=offset, + max_messages=max_messages, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Message]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_stream_sid_message_get_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + since: Annotated[StrictInt, Field(description="Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + offset: Annotated[Optional[StrictInt], Field(description="No. of messages to skip.")] = None, + max_messages: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return. If no value is provided, 50 is the default.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Get messages from an existing stream. + + A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. + + :param sid: Stream ID (required) + :type sid: str + :param since: Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type since: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param offset: No. of messages to skip. + :type offset: int + :param max_messages: Max No. of messages to return. If no value is provided, 50 is the default. + :type max_messages: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v1/stream/{sid}/message is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_message_get_serialize( + sid=sid, + since=since, + session_token=session_token, + offset=offset, + max_messages=max_messages, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Message]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_stream_sid_message_get_serialize( + self, + sid, + since, + session_token, + offset, + max_messages, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + if since is not None: + + _query_params.append(('since', since)) + + if offset is not None: + + _query_params.append(('offset', offset)) + + if max_messages is not None: + + _query_params.append(('maxMessages', max_messages)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/stream/{sid}/message', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_message_import_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_list: List[V2ImportedMessage], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V2ImportResponse]: + """(Deprecated) Import messages from other systems into Symphony. + + Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. Optionally the original message ID can be specified to identify the imported message for the purpose of repeat imports. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_list: (required) + :type message_list: List[V2ImportedMessage] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v2/message/import is deprecated.", DeprecationWarning) + + _param = self._v2_message_import_post_serialize( + session_token=session_token, + message_list=message_list, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2ImportResponse]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_message_import_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_list: List[V2ImportedMessage], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V2ImportResponse]]: + """(Deprecated) Import messages from other systems into Symphony. + + Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. Optionally the original message ID can be specified to identify the imported message for the purpose of repeat imports. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_list: (required) + :type message_list: List[V2ImportedMessage] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v2/message/import is deprecated.", DeprecationWarning) + + _param = self._v2_message_import_post_serialize( + session_token=session_token, + message_list=message_list, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2ImportResponse]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_message_import_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_list: List[V2ImportedMessage], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Import messages from other systems into Symphony. + + Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. Optionally the original message ID can be specified to identify the imported message for the purpose of repeat imports. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_list: (required) + :type message_list: List[V2ImportedMessage] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v2/message/import is deprecated.", DeprecationWarning) + + _param = self._v2_message_import_post_serialize( + session_token=session_token, + message_list=message_list, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2ImportResponse]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_message_import_post_serialize( + self, + session_token, + message_list, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'messageList': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if message_list is not None: + _body_params = message_list + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v2/message/import', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_stream_sid_message_create_post( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message: V2MessageSubmission, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2Message: + """(Deprecated) Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message (see the V2MessageSubmission parameter). If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param message: (required) + :type message: V2MessageSubmission + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v2/stream/{sid}/message/create is deprecated.", DeprecationWarning) + + _param = self._v2_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + message=message, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_stream_sid_message_create_post_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message: V2MessageSubmission, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2Message]: + """(Deprecated) Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message (see the V2MessageSubmission parameter). If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param message: (required) + :type message: V2MessageSubmission + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v2/stream/{sid}/message/create is deprecated.", DeprecationWarning) + + _param = self._v2_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + message=message, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_stream_sid_message_create_post_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message: V2MessageSubmission, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message (see the V2MessageSubmission parameter). If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param message: (required) + :type message: V2MessageSubmission + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v2/stream/{sid}/message/create is deprecated.", DeprecationWarning) + + _param = self._v2_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + message=message, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_stream_sid_message_create_post_serialize( + self, + sid, + session_token, + message, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if message is not None: + _body_params = message + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v2/stream/{sid}/message/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_stream_sid_message_get( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + since: Annotated[StrictInt, Field(description="Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + offset: Annotated[Optional[StrictInt], Field(description="No. of messages to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return. If no value is provided, 50 is the default.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V2BaseMessage]: + """(Deprecated) Get messages from an existing stream. + + A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. + + :param sid: Stream ID (required) + :type sid: str + :param since: Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type since: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param offset: No. of messages to skip. + :type offset: int + :param limit: Max No. of messages to return. If no value is provided, 50 is the default. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v2/stream/{sid}/message is deprecated.", DeprecationWarning) + + _param = self._v2_stream_sid_message_get_serialize( + sid=sid, + since=since, + session_token=session_token, + offset=offset, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2BaseMessage]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_stream_sid_message_get_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + since: Annotated[StrictInt, Field(description="Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + offset: Annotated[Optional[StrictInt], Field(description="No. of messages to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return. If no value is provided, 50 is the default.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V2BaseMessage]]: + """(Deprecated) Get messages from an existing stream. + + A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. + + :param sid: Stream ID (required) + :type sid: str + :param since: Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type since: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param offset: No. of messages to skip. + :type offset: int + :param limit: Max No. of messages to return. If no value is provided, 50 is the default. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v2/stream/{sid}/message is deprecated.", DeprecationWarning) + + _param = self._v2_stream_sid_message_get_serialize( + sid=sid, + since=since, + session_token=session_token, + offset=offset, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2BaseMessage]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_stream_sid_message_get_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + since: Annotated[StrictInt, Field(description="Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + offset: Annotated[Optional[StrictInt], Field(description="No. of messages to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return. If no value is provided, 50 is the default.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Get messages from an existing stream. + + A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. + + :param sid: Stream ID (required) + :type sid: str + :param since: Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type since: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param offset: No. of messages to skip. + :type offset: int + :param limit: Max No. of messages to return. If no value is provided, 50 is the default. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v2/stream/{sid}/message is deprecated.", DeprecationWarning) + + _param = self._v2_stream_sid_message_get_serialize( + sid=sid, + since=since, + session_token=session_token, + offset=offset, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2BaseMessage]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_stream_sid_message_get_serialize( + self, + sid, + since, + session_token, + offset, + limit, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + if since is not None: + + _query_params.append(('since', since)) + + if offset is not None: + + _query_params.append(('offset', offset)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/stream/{sid}/message', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_stream_sid_message_create_post( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + message: V2MessageSubmission, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2Message: + """(Deprecated) PROVISIONAL - Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message (see the V2MessageSubmission parameter). If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param message: (required) + :type message: V2MessageSubmission + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v3/stream/{sid}/message/create is deprecated.", DeprecationWarning) + + _param = self._v3_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + message=message, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_stream_sid_message_create_post_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + message: V2MessageSubmission, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2Message]: + """(Deprecated) PROVISIONAL - Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message (see the V2MessageSubmission parameter). If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param message: (required) + :type message: V2MessageSubmission + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v3/stream/{sid}/message/create is deprecated.", DeprecationWarning) + + _param = self._v3_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + message=message, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_stream_sid_message_create_post_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + message: V2MessageSubmission, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) PROVISIONAL - Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message (see the V2MessageSubmission parameter). If the message parameter type is TEXT then the message contains plain text and cannot include formating, hash tags, mentions etc. If the message parameter type is MessageML then the message contains MessageML which allows for these entities. If the message is in MessageML and fails schema validation a client error results If the message is sent then 200 is returned. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param message: (required) + :type message: V2MessageSubmission + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v3/stream/{sid}/message/create is deprecated.", DeprecationWarning) + + _param = self._v3_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + message=message, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_stream_sid_message_create_post_serialize( + self, + sid, + session_token, + message, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if message is not None: + _body_params = message + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/stream/{sid}/message/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v4_message_blast_post( + self, + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + sids: Annotated[List[StrictStr], Field(description="A comma-separated list of Stream IDs")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + message: Annotated[Optional[StrictStr], Field(description="The message payload in MessageML.")] = None, + data: Annotated[Optional[StrictStr], Field(description="Optional message data in EntityJSON.")] = None, + version: Annotated[Optional[StrictStr], Field(description="Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. ")] = None, + attachment: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional file attachment.")] = None, + preview: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional attachment preview.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V4MessageBlastResponse: + """Post a message to multiple existing streams. + + Post a new message to the given list of streams. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. If the message is in MessageML and fails schema validation a client error results This endpoint is idempotent, it means that a 200 response will be returned even if the message has not been delivered to some streams. Check the `errors` map from the response in order to see on which stream(s) the message has not been delivered. The maximum number of streams where the message can be sent is limitted to 100. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. + + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param sids: A comma-separated list of Stream IDs (required) + :type sids: List[str] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param message: The message payload in MessageML. + :type message: str + :param data: Optional message data in EntityJSON. + :type data: str + :param version: Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. + :type version: str + :param attachment: Optional file attachment. + :type attachment: bytearray + :param preview: Optional attachment preview. + :type preview: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_message_blast_post_serialize( + session_token=session_token, + sids=sids, + key_manager_token=key_manager_token, + message=message, + data=data, + version=version, + attachment=attachment, + preview=preview, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4MessageBlastResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v4_message_blast_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + sids: Annotated[List[StrictStr], Field(description="A comma-separated list of Stream IDs")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + message: Annotated[Optional[StrictStr], Field(description="The message payload in MessageML.")] = None, + data: Annotated[Optional[StrictStr], Field(description="Optional message data in EntityJSON.")] = None, + version: Annotated[Optional[StrictStr], Field(description="Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. ")] = None, + attachment: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional file attachment.")] = None, + preview: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional attachment preview.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V4MessageBlastResponse]: + """Post a message to multiple existing streams. + + Post a new message to the given list of streams. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. If the message is in MessageML and fails schema validation a client error results This endpoint is idempotent, it means that a 200 response will be returned even if the message has not been delivered to some streams. Check the `errors` map from the response in order to see on which stream(s) the message has not been delivered. The maximum number of streams where the message can be sent is limitted to 100. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. + + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param sids: A comma-separated list of Stream IDs (required) + :type sids: List[str] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param message: The message payload in MessageML. + :type message: str + :param data: Optional message data in EntityJSON. + :type data: str + :param version: Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. + :type version: str + :param attachment: Optional file attachment. + :type attachment: bytearray + :param preview: Optional attachment preview. + :type preview: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_message_blast_post_serialize( + session_token=session_token, + sids=sids, + key_manager_token=key_manager_token, + message=message, + data=data, + version=version, + attachment=attachment, + preview=preview, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4MessageBlastResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v4_message_blast_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + sids: Annotated[List[StrictStr], Field(description="A comma-separated list of Stream IDs")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + message: Annotated[Optional[StrictStr], Field(description="The message payload in MessageML.")] = None, + data: Annotated[Optional[StrictStr], Field(description="Optional message data in EntityJSON.")] = None, + version: Annotated[Optional[StrictStr], Field(description="Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. ")] = None, + attachment: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional file attachment.")] = None, + preview: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional attachment preview.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Post a message to multiple existing streams. + + Post a new message to the given list of streams. The stream can be a chatroom, an IM or a multiparty IM. You may include an attachment on the message. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. If the message is in MessageML and fails schema validation a client error results This endpoint is idempotent, it means that a 200 response will be returned even if the message has not been delivered to some streams. Check the `errors` map from the response in order to see on which stream(s) the message has not been delivered. The maximum number of streams where the message can be sent is limitted to 100. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. + + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param sids: A comma-separated list of Stream IDs (required) + :type sids: List[str] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param message: The message payload in MessageML. + :type message: str + :param data: Optional message data in EntityJSON. + :type data: str + :param version: Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. + :type version: str + :param attachment: Optional file attachment. + :type attachment: bytearray + :param preview: Optional attachment preview. + :type preview: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_message_blast_post_serialize( + session_token=session_token, + sids=sids, + key_manager_token=key_manager_token, + message=message, + data=data, + version=version, + attachment=attachment, + preview=preview, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4MessageBlastResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v4_message_blast_post_serialize( + self, + session_token, + sids, + key_manager_token, + message, + data, + version, + attachment, + preview, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'sids': 'csv', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + if sids is not None: + _form_params.append(('sids', sids)) + if message is not None: + _form_params.append(('message', message)) + if data is not None: + _form_params.append(('data', data)) + if version is not None: + _form_params.append(('version', version)) + if attachment is not None: + _files['attachment'] = attachment + if preview is not None: + _files['preview'] = preview + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v4/message/blast', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v4_message_import_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_list: List[V4ImportedMessage], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V4ImportResponse]: + """Import messages from other systems into Symphony. + + Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. Optionally the original message ID can be specified to identify the imported message for the purpose of repeat imports. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_list: (required) + :type message_list: List[V4ImportedMessage] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_message_import_post_serialize( + session_token=session_token, + message_list=message_list, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4ImportResponse]", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v4_message_import_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_list: List[V4ImportedMessage], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V4ImportResponse]]: + """Import messages from other systems into Symphony. + + Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. Optionally the original message ID can be specified to identify the imported message for the purpose of repeat imports. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_list: (required) + :type message_list: List[V4ImportedMessage] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_message_import_post_serialize( + session_token=session_token, + message_list=message_list, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4ImportResponse]", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v4_message_import_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_list: List[V4ImportedMessage], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Import messages from other systems into Symphony. + + Sends a message to be imported into the system. Allows you to override the timestamp and author of the message with your desired values. The requesting user must have the Content Management role. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. Optionally the original message ID can be specified to identify the imported message for the purpose of repeat imports. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_list: (required) + :type message_list: List[V4ImportedMessage] + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_message_import_post_serialize( + session_token=session_token, + message_list=message_list, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4ImportResponse]", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v4_message_import_post_serialize( + self, + session_token, + message_list, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'messageList': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if message_list is not None: + _body_params = message_list + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v4/message/import', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v4_stream_sid_message_create_post( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + message: Annotated[Optional[StrictStr], Field(description="The message payload in MessageML.")] = None, + data: Annotated[Optional[StrictStr], Field(description="Optional message data in EntityJSON.")] = None, + version: Annotated[Optional[StrictStr], Field(description="Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. ")] = None, + attachment: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional file attachment.")] = None, + preview: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional attachment preview.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V4Message: + """Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom,,an IM or a multiparty IM. You may include an attachment on the message. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. If the message is in MessageML and fails schema validation a client error will be returned. If the message is sent then 200 is returned. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param message: The message payload in MessageML. + :type message: str + :param data: Optional message data in EntityJSON. + :type data: str + :param version: Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. + :type version: str + :param attachment: Optional file attachment. + :type attachment: bytearray + :param preview: Optional attachment preview. + :type preview: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + key_manager_token=key_manager_token, + message=message, + data=data, + version=version, + attachment=attachment, + preview=preview, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4Message", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v4_stream_sid_message_create_post_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + message: Annotated[Optional[StrictStr], Field(description="The message payload in MessageML.")] = None, + data: Annotated[Optional[StrictStr], Field(description="Optional message data in EntityJSON.")] = None, + version: Annotated[Optional[StrictStr], Field(description="Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. ")] = None, + attachment: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional file attachment.")] = None, + preview: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional attachment preview.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V4Message]: + """Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom,,an IM or a multiparty IM. You may include an attachment on the message. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. If the message is in MessageML and fails schema validation a client error will be returned. If the message is sent then 200 is returned. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param message: The message payload in MessageML. + :type message: str + :param data: Optional message data in EntityJSON. + :type data: str + :param version: Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. + :type version: str + :param attachment: Optional file attachment. + :type attachment: bytearray + :param preview: Optional attachment preview. + :type preview: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + key_manager_token=key_manager_token, + message=message, + data=data, + version=version, + attachment=attachment, + preview=preview, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4Message", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v4_stream_sid_message_create_post_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + message: Annotated[Optional[StrictStr], Field(description="The message payload in MessageML.")] = None, + data: Annotated[Optional[StrictStr], Field(description="Optional message data in EntityJSON.")] = None, + version: Annotated[Optional[StrictStr], Field(description="Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. ")] = None, + attachment: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional file attachment.")] = None, + preview: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional attachment preview.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Post a message to one existing stream. + + Post a new message to the given stream. The stream can be a chatroom,,an IM or a multiparty IM. You may include an attachment on the message. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. If the message is in MessageML and fails schema validation a client error will be returned. If the message is sent then 200 is returned. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param message: The message payload in MessageML. + :type message: str + :param data: Optional message data in EntityJSON. + :type data: str + :param version: Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. + :type version: str + :param attachment: Optional file attachment. + :type attachment: bytearray + :param preview: Optional attachment preview. + :type preview: bytearray + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_stream_sid_message_create_post_serialize( + sid=sid, + session_token=session_token, + key_manager_token=key_manager_token, + message=message, + data=data, + version=version, + attachment=attachment, + preview=preview, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4Message", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v4_stream_sid_message_create_post_serialize( + self, + sid, + session_token, + key_manager_token, + message, + data, + version, + attachment, + preview, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + if message is not None: + _form_params.append(('message', message)) + if data is not None: + _form_params.append(('data', data)) + if version is not None: + _form_params.append(('version', version)) + if attachment is not None: + _files['attachment'] = attachment + if preview is not None: + _files['preview'] = preview + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v4/stream/{sid}/message/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v4_stream_sid_message_get( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + since: Annotated[StrictInt, Field(description="Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of messages to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V4Message]: + """Get messages from an existing stream. + + A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. + + :param sid: Stream ID (required) + :type sid: str + :param since: Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type since: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: No. of messages to skip. + :type skip: int + :param limit: Max No. of messages to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_stream_sid_message_get_serialize( + sid=sid, + since=since, + session_token=session_token, + skip=skip, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Message]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v4_stream_sid_message_get_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + since: Annotated[StrictInt, Field(description="Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of messages to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V4Message]]: + """Get messages from an existing stream. + + A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. + + :param sid: Stream ID (required) + :type sid: str + :param since: Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type since: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: No. of messages to skip. + :type skip: int + :param limit: Max No. of messages to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_stream_sid_message_get_serialize( + sid=sid, + since=since, + session_token=session_token, + skip=skip, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Message]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v4_stream_sid_message_get_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + since: Annotated[StrictInt, Field(description="Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of messages to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of messages to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get messages from an existing stream. + + A caller can fetch all unseen messages by passing the timestamp of the last message seen as the since parameter and the number of messages with the same timestamp value already seen as the skip parameter. This means that every message will be seen exactly once even in the case that an additional message is processed with the same timestamp as the last message returned by the previous call, and the case where there are more than maxMessages with the same timestamp value. This method is intended for historic queries and is generally reliable but if guaranteed delivery of every message in real time is required then the equivilent firehose method should be called. + + :param sid: Stream ID (required) + :type sid: str + :param since: Timestamp of first required message. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type since: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: No. of messages to skip. + :type skip: int + :param limit: Max No. of messages to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_stream_sid_message_get_serialize( + sid=sid, + since=since, + session_token=session_token, + skip=skip, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V4Message]", + '204': None, + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v4_stream_sid_message_get_serialize( + self, + sid, + since, + session_token, + skip, + limit, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + if since is not None: + + _query_params.append(('since', since)) + + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v4/stream/{sid}/message', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v4_stream_sid_message_mid_update_post( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + mid: Annotated[StrictStr, Field(description="ID of the message to be updated")], + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + message: Annotated[Optional[StrictStr], Field(description="The message payload in MessageML.")] = None, + data: Annotated[Optional[StrictStr], Field(description="Optional message data in EntityJSON.")] = None, + version: Annotated[Optional[StrictStr], Field(description="Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. ")] = None, + attachment: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional file attachment.")] = None, + preview: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional attachment preview.")] = None, + silent: Annotated[Optional[StrictStr], Field(description="Optional boolean field that will determine if the user/s should receive the message as read or not (true by default) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V4Message: + """Update an existing message. + + Update an existing message. The existing message must be a valid social message, that has not been deleted. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. Starting with SBE v24.1, attachments are supported. + + :param sid: Stream ID (required) + :type sid: str + :param mid: ID of the message to be updated (required) + :type mid: str + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param message: The message payload in MessageML. + :type message: str + :param data: Optional message data in EntityJSON. + :type data: str + :param version: Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. + :type version: str + :param attachment: Optional file attachment. + :type attachment: bytearray + :param preview: Optional attachment preview. + :type preview: bytearray + :param silent: Optional boolean field that will determine if the user/s should receive the message as read or not (true by default) + :type silent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_stream_sid_message_mid_update_post_serialize( + sid=sid, + mid=mid, + session_token=session_token, + key_manager_token=key_manager_token, + message=message, + data=data, + version=version, + attachment=attachment, + preview=preview, + silent=silent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4Message", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v4_stream_sid_message_mid_update_post_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + mid: Annotated[StrictStr, Field(description="ID of the message to be updated")], + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + message: Annotated[Optional[StrictStr], Field(description="The message payload in MessageML.")] = None, + data: Annotated[Optional[StrictStr], Field(description="Optional message data in EntityJSON.")] = None, + version: Annotated[Optional[StrictStr], Field(description="Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. ")] = None, + attachment: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional file attachment.")] = None, + preview: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional attachment preview.")] = None, + silent: Annotated[Optional[StrictStr], Field(description="Optional boolean field that will determine if the user/s should receive the message as read or not (true by default) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V4Message]: + """Update an existing message. + + Update an existing message. The existing message must be a valid social message, that has not been deleted. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. Starting with SBE v24.1, attachments are supported. + + :param sid: Stream ID (required) + :type sid: str + :param mid: ID of the message to be updated (required) + :type mid: str + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param message: The message payload in MessageML. + :type message: str + :param data: Optional message data in EntityJSON. + :type data: str + :param version: Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. + :type version: str + :param attachment: Optional file attachment. + :type attachment: bytearray + :param preview: Optional attachment preview. + :type preview: bytearray + :param silent: Optional boolean field that will determine if the user/s should receive the message as read or not (true by default) + :type silent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_stream_sid_message_mid_update_post_serialize( + sid=sid, + mid=mid, + session_token=session_token, + key_manager_token=key_manager_token, + message=message, + data=data, + version=version, + attachment=attachment, + preview=preview, + silent=silent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4Message", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v4_stream_sid_message_mid_update_post_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + mid: Annotated[StrictStr, Field(description="ID of the message to be updated")], + session_token: Annotated[StrictStr, Field(description="Authorization token used to make delegated calls.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + message: Annotated[Optional[StrictStr], Field(description="The message payload in MessageML.")] = None, + data: Annotated[Optional[StrictStr], Field(description="Optional message data in EntityJSON.")] = None, + version: Annotated[Optional[StrictStr], Field(description="Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. ")] = None, + attachment: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional file attachment.")] = None, + preview: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="Optional attachment preview.")] = None, + silent: Annotated[Optional[StrictStr], Field(description="Optional boolean field that will determine if the user/s should receive the message as read or not (true by default) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an existing message. + + Update an existing message. The existing message must be a valid social message, that has not been deleted. The message can be provided as MessageMLV2 or PresentationML. Both formats support Freemarker templates. The optional parameter \"data\" can be used to provide a JSON payload containing entity data. If the message contains explicit references to entity data (in \"data-entity-id\" element attributes), this parameter is required. Regarding authentication, you must either use the sessionToken which was created for delegated app access or both the sessionToken and keyManagerToken together. Starting with SBE v24.1, attachments are supported. + + :param sid: Stream ID (required) + :type sid: str + :param mid: ID of the message to be updated (required) + :type mid: str + :param session_token: Authorization token used to make delegated calls. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param message: The message payload in MessageML. + :type message: str + :param data: Optional message data in EntityJSON. + :type data: str + :param version: Optional message version in the format \\\"major.minor\\\". If empty, defaults to the latest supported version. + :type version: str + :param attachment: Optional file attachment. + :type attachment: bytearray + :param preview: Optional attachment preview. + :type preview: bytearray + :param silent: Optional boolean field that will determine if the user/s should receive the message as read or not (true by default) + :type silent: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v4_stream_sid_message_mid_update_post_serialize( + sid=sid, + mid=mid, + session_token=session_token, + key_manager_token=key_manager_token, + message=message, + data=data, + version=version, + attachment=attachment, + preview=preview, + silent=silent, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V4Message", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v4_stream_sid_message_mid_update_post_serialize( + self, + sid, + mid, + session_token, + key_manager_token, + message, + data, + version, + attachment, + preview, + silent, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + if mid is not None: + _path_params['mid'] = mid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + if message is not None: + _form_params.append(('message', message)) + if data is not None: + _form_params.append(('data', data)) + if version is not None: + _form_params.append(('version', version)) + if attachment is not None: + _files['attachment'] = attachment + if preview is not None: + _files['preview'] = preview + if silent is not None: + _form_params.append(('silent', silent)) + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v4/stream/{sid}/message/{mid}/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/agent_api/share_api.py b/symphony/bdk/gen/agent_api/share_api.py index 1b3fe248..8a3321ed 100644 --- a/symphony/bdk/gen/agent_api/share_api.py +++ b/symphony/bdk/gen/agent_api/share_api.py @@ -1,348 +1,703 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.agent_model.error import Error +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated from symphony.bdk.gen.agent_model.share_content import ShareContent from symphony.bdk.gen.agent_model.v2_message import V2Message +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class ShareApi(object): +class ShareApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_stream_sid_share_post_endpoint = _Endpoint( - settings={ - 'response_type': (V2Message,), - 'auth': [], - 'endpoint_path': '/v1/stream/{sid}/share', - 'operation_id': 'v1_stream_sid_share_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'session_token', - 'share_content', - 'key_manager_token', - ], - 'required': [ - 'sid', - 'session_token', - 'share_content', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'session_token': - (str,), - 'share_content': - (ShareContent,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'sid': 'path', - 'session_token': 'header', - 'share_content': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v3_stream_sid_share_post_endpoint = _Endpoint( - settings={ - 'response_type': (V2Message,), - 'auth': [], - 'endpoint_path': '/v3/stream/{sid}/share', - 'operation_id': 'v3_stream_sid_share_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'session_token', - 'share_content', - 'key_manager_token', - ], - 'required': [ - 'sid', - 'session_token', - 'share_content', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'session_token': - (str,), - 'share_content': - (ShareContent,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'sid': 'path', - 'session_token': 'header', - 'share_content': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - def v1_stream_sid_share_post( + + @validate_call + async def v1_stream_sid_share_post( self, - sid, - session_token, - share_content, - **kwargs - ): - """Share a piece of content into Symphony # noqa: E501 - - Given a 3rd party content (eg. news article), it can share to the given stream. The stream can be a chatroom, an IM or a multiparty IM. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_stream_sid_share_post(sid, session_token, share_content, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - session_token (str): Session authentication token. - share_content (ShareContent): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2Message - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + share_content: ShareContent, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2Message: + """(Deprecated) Share a piece of content into Symphony + + Given a 3rd party content (eg. news article), it can share to the given stream. The stream can be a chatroom, an IM or a multiparty IM. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param share_content: (required) + :type share_content: ShareContent + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/stream/{sid}/share is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_share_post_serialize( + sid=sid, + session_token=session_token, + share_content=share_content, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_stream_sid_share_post_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + share_content: ShareContent, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2Message]: + """(Deprecated) Share a piece of content into Symphony + + Given a 3rd party content (eg. news article), it can share to the given stream. The stream can be a chatroom, an IM or a multiparty IM. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param share_content: (required) + :type share_content: ShareContent + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/stream/{sid}/share is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_share_post_serialize( + sid=sid, + session_token=session_token, + share_content=share_content, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_stream_sid_share_post_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + share_content: ShareContent, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Share a piece of content into Symphony + + Given a 3rd party content (eg. news article), it can share to the given stream. The stream can be a chatroom, an IM or a multiparty IM. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param share_content: (required) + :type share_content: ShareContent + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/stream/{sid}/share is deprecated.", DeprecationWarning) + + _param = self._v1_stream_sid_share_post_serialize( + sid=sid, + session_token=session_token, + share_content=share_content, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['session_token'] = \ - session_token - kwargs['share_content'] = \ - share_content - return self.v1_stream_sid_share_post_endpoint.call_with_http_info(**kwargs) - - def v3_stream_sid_share_post( + return response_data.response + + + def _v1_stream_sid_share_post_serialize( self, sid, session_token, share_content, - **kwargs - ): - """PROVISIONAL - Share a piece of content into Symphony # noqa: E501 - - Given a 3rd party content (eg. news article), it can share to the given stream. The stream can be a chatroom, an IM or a multiparty IM. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_stream_sid_share_post(sid, session_token, share_content, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream ID - session_token (str): Session authentication token. - share_content (ShareContent): - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2Message - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if share_content is not None: + _body_params = share_content + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/stream/{sid}/share', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def v3_stream_sid_share_post( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + share_content: ShareContent, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2Message: + """PROVISIONAL - Share a piece of content into Symphony + + Given a 3rd party content (eg. news article), it can share to the given stream. The stream can be a chatroom, an IM or a multiparty IM. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param share_content: (required) + :type share_content: ShareContent + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_stream_sid_share_post_serialize( + sid=sid, + session_token=session_token, + share_content=share_content, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_stream_sid_share_post_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + share_content: ShareContent, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2Message]: + """PROVISIONAL - Share a piece of content into Symphony + + Given a 3rd party content (eg. news article), it can share to the given stream. The stream can be a chatroom, an IM or a multiparty IM. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param share_content: (required) + :type share_content: ShareContent + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_stream_sid_share_post_serialize( + sid=sid, + session_token=session_token, + share_content=share_content, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_stream_sid_share_post_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + share_content: ShareContent, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """PROVISIONAL - Share a piece of content into Symphony + + Given a 3rd party content (eg. news article), it can share to the given stream. The stream can be a chatroom, an IM or a multiparty IM. + + :param sid: Stream ID (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param share_content: (required) + :type share_content: ShareContent + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_stream_sid_share_post_serialize( + sid=sid, + session_token=session_token, + share_content=share_content, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Message", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + return response_data.response + + + def _v3_stream_sid_share_post_serialize( + self, + sid, + session_token, + share_content, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if share_content is not None: + _body_params = share_content + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/stream/{sid}/share', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['session_token'] = \ - session_token - kwargs['share_content'] = \ - share_content - return self.v3_stream_sid_share_post_endpoint.call_with_http_info(**kwargs) + diff --git a/symphony/bdk/gen/agent_api/signals_api.py b/symphony/bdk/gen/agent_api/signals_api.py index 5ef7dca9..b57bb9ff 100644 --- a/symphony/bdk/gen/agent_api/signals_api.py +++ b/symphony/bdk/gen/agent_api/signals_api.py @@ -1,1341 +1,2865 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) +from pydantic import Field, StrictBool, StrictInt, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.agent_model.agent_info import AgentInfo from symphony.bdk.gen.agent_model.base_signal import BaseSignal from symphony.bdk.gen.agent_model.channel_subscriber_response import ChannelSubscriberResponse from symphony.bdk.gen.agent_model.channel_subscription_response import ChannelSubscriptionResponse from symphony.bdk.gen.agent_model.signal import Signal -from symphony.bdk.gen.agent_model.signal_list import SignalList from symphony.bdk.gen.agent_model.success_response import SuccessResponse -from symphony.bdk.gen.agent_model.v2_error import V2Error + +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class SignalsApi(object): +class SignalsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_info_get_endpoint = _Endpoint( - settings={ - 'response_type': (AgentInfo,), - 'auth': [], - 'endpoint_path': '/v1/info', - 'operation_id': 'v1_info_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - }, - 'attribute_map': { - }, - 'location_map': { - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_signals_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (Signal,), - 'auth': [], - 'endpoint_path': '/v1/signals/create', - 'operation_id': 'v1_signals_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'signal', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'signal', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'signal': - (BaseSignal,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'signal': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_signals_id_delete_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/signals/{id}/delete', - 'operation_id': 'v1_signals_id_delete_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'id', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'id': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'id': 'id', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'id': 'path', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_signals_id_get_get_endpoint = _Endpoint( - settings={ - 'response_type': (Signal,), - 'auth': [], - 'endpoint_path': '/v1/signals/{id}/get', - 'operation_id': 'v1_signals_id_get_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'id', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'id': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'id': 'id', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'id': 'path', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_signals_id_subscribe_post_endpoint = _Endpoint( - settings={ - 'response_type': (ChannelSubscriptionResponse,), - 'auth': [], - 'endpoint_path': '/v1/signals/{id}/subscribe', - 'operation_id': 'v1_signals_id_subscribe_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'id', - 'key_manager_token', - 'pushed', - 'users', - ], - 'required': [ - 'session_token', - 'id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'id': - (str,), - 'key_manager_token': - (str,), - 'pushed': - (bool,), - 'users': - ([int],), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'id': 'id', - 'key_manager_token': 'keyManagerToken', - 'pushed': 'pushed', - }, - 'location_map': { - 'session_token': 'header', - 'id': 'path', - 'key_manager_token': 'header', - 'pushed': 'query', - 'users': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_signals_id_subscribers_get_endpoint = _Endpoint( - settings={ - 'response_type': (ChannelSubscriberResponse,), - 'auth': [], - 'endpoint_path': '/v1/signals/{id}/subscribers', - 'operation_id': 'v1_signals_id_subscribers_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'id', - 'key_manager_token', - 'skip', - 'limit', - ], - 'required': [ - 'session_token', - 'id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'id': - (str,), - 'key_manager_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'id': 'id', - 'key_manager_token': 'keyManagerToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'id': 'path', - 'key_manager_token': 'header', - 'skip': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_signals_id_unsubscribe_post_endpoint = _Endpoint( - settings={ - 'response_type': (ChannelSubscriptionResponse,), - 'auth': [], - 'endpoint_path': '/v1/signals/{id}/unsubscribe', - 'operation_id': 'v1_signals_id_unsubscribe_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'id', - 'key_manager_token', - 'users', - ], - 'required': [ - 'session_token', - 'id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'id': - (str,), - 'key_manager_token': - (str,), - 'users': - ([int],), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'id': 'id', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'id': 'path', - 'key_manager_token': 'header', - 'users': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_signals_id_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (Signal,), - 'auth': [], - 'endpoint_path': '/v1/signals/{id}/update', - 'operation_id': 'v1_signals_id_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'id', - 'signal', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'id', - 'signal', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'id': - (str,), - 'signal': - (BaseSignal,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'id': 'id', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'id': 'path', - 'signal': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ + + + @validate_call + async def v1_info_get( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AgentInfo: + """Get information about the Agent + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_info_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AgentInfo", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_info_get_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AgentInfo]: + """Get information about the Agent + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_info_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AgentInfo", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_info_get_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get information about the Agent + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_info_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AgentInfo", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_info_get_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' ] - }, - api_client=api_client - ) - self.v1_signals_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (SignalList,), - 'auth': [], - 'endpoint_path': '/v1/signals/list', - 'operation_id': 'v1_signals_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'key_manager_token', - 'skip', - 'limit', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'key_manager_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'key_manager_token': 'header', - 'skip': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/info', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def v1_info_get( + + + + @validate_call + async def v1_signals_create_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + signal: Annotated[BaseSignal, Field(description="Signal definition.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Signal: + """Create a signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param signal: Signal definition. (required) + :type signal: BaseSignal + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_create_post_serialize( + session_token=session_token, + signal=signal, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Signal", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_signals_create_post_with_http_info( self, - **kwargs - ): - """Get information about the Agent # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_info_get(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - AgentInfo - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.v1_info_get_endpoint.call_with_http_info(**kwargs) - - def v1_signals_create_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + signal: Annotated[BaseSignal, Field(description="Signal definition.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Signal]: + """Create a signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param signal: Signal definition. (required) + :type signal: BaseSignal + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_create_post_serialize( + session_token=session_token, + signal=signal, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Signal", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_signals_create_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + signal: Annotated[BaseSignal, Field(description="Signal definition.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param signal: Signal definition. (required) + :type signal: BaseSignal + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_create_post_serialize( + session_token=session_token, + signal=signal, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Signal", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_signals_create_post_serialize( self, session_token, signal, - **kwargs - ): - """Create a signal. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_signals_create_post(session_token, signal, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - signal (BaseSignal): Signal definition. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Signal - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['signal'] = \ - signal - return self.v1_signals_create_post_endpoint.call_with_http_info(**kwargs) - - def v1_signals_id_delete_post( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if signal is not None: + _body_params = signal + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/signals/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_signals_id_delete_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Delete a signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_delete_post_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_signals_id_delete_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Delete a signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_delete_post_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_signals_id_delete_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_delete_post_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_signals_id_delete_post_serialize( self, session_token, id, - **kwargs - ): - """Delete a signal. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_signals_id_delete_post(session_token, id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - id (str): The id of the signal. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['id'] = \ - id - return self.v1_signals_id_delete_post_endpoint.call_with_http_info(**kwargs) - - def v1_signals_id_get_get( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/signals/{id}/delete', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_signals_id_get_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The ID of the signal to display.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Signal: + """Get details of the requested signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The ID of the signal to display. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_get_get_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Signal", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_signals_id_get_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The ID of the signal to display.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Signal]: + """Get details of the requested signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The ID of the signal to display. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_get_get_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Signal", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_signals_id_get_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The ID of the signal to display.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get details of the requested signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The ID of the signal to display. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_get_get_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Signal", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_signals_id_get_get_serialize( self, session_token, id, - **kwargs - ): - """Get details of the requested signal. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_signals_id_get_get(session_token, id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - id (str): The ID of the signal to display. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Signal - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['id'] = \ - id - return self.v1_signals_id_get_get_endpoint.call_with_http_info(**kwargs) - - def v1_signals_id_subscribe_post( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/signals/{id}/get', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_signals_id_subscribe_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + pushed: Annotated[Optional[StrictBool], Field(description="Prevent the user to unsubscribe (only for bulk subscription)")] = None, + users: Annotated[Optional[List[StrictInt]], Field(description="UserIds to subscribe (only for bulk subscription)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ChannelSubscriptionResponse: + """Subscribe to a Signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param pushed: Prevent the user to unsubscribe (only for bulk subscription) + :type pushed: bool + :param users: UserIds to subscribe (only for bulk subscription) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_subscribe_post_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + pushed=pushed, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChannelSubscriptionResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_signals_id_subscribe_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + pushed: Annotated[Optional[StrictBool], Field(description="Prevent the user to unsubscribe (only for bulk subscription)")] = None, + users: Annotated[Optional[List[StrictInt]], Field(description="UserIds to subscribe (only for bulk subscription)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ChannelSubscriptionResponse]: + """Subscribe to a Signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param pushed: Prevent the user to unsubscribe (only for bulk subscription) + :type pushed: bool + :param users: UserIds to subscribe (only for bulk subscription) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_subscribe_post_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + pushed=pushed, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChannelSubscriptionResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_signals_id_subscribe_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + pushed: Annotated[Optional[StrictBool], Field(description="Prevent the user to unsubscribe (only for bulk subscription)")] = None, + users: Annotated[Optional[List[StrictInt]], Field(description="UserIds to subscribe (only for bulk subscription)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Subscribe to a Signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param pushed: Prevent the user to unsubscribe (only for bulk subscription) + :type pushed: bool + :param users: UserIds to subscribe (only for bulk subscription) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_subscribe_post_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + pushed=pushed, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChannelSubscriptionResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_signals_id_subscribe_post_serialize( self, session_token, id, - **kwargs - ): - """Subscribe to a Signal. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_signals_id_subscribe_post(session_token, id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - id (str): The id of the signal. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - pushed (bool): Prevent the user to unsubscribe (only for bulk subscription). [optional] - users ([int]): UserIds to subscribe (only for bulk subscription). [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ChannelSubscriptionResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['id'] = \ - id - return self.v1_signals_id_subscribe_post_endpoint.call_with_http_info(**kwargs) - - def v1_signals_id_subscribers_get( + key_manager_token, + pushed, + users, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'users': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if pushed is not None: + + _query_params.append(('pushed', pushed)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if users is not None: + _body_params = users + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/signals/{id}/subscribe', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_signals_id_subscribers_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of subscribers to return. If no value is provided, 100 is the default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ChannelSubscriberResponse: + """Get the subscribers of a signal + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param skip: No. of results to skip. + :type skip: int + :param limit: Max No. of subscribers to return. If no value is provided, 100 is the default. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_subscribers_get_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChannelSubscriberResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_signals_id_subscribers_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of subscribers to return. If no value is provided, 100 is the default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ChannelSubscriberResponse]: + """Get the subscribers of a signal + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param skip: No. of results to skip. + :type skip: int + :param limit: Max No. of subscribers to return. If no value is provided, 100 is the default. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_subscribers_get_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChannelSubscriberResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_signals_id_subscribers_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of subscribers to return. If no value is provided, 100 is the default.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the subscribers of a signal + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param skip: No. of results to skip. + :type skip: int + :param limit: Max No. of subscribers to return. If no value is provided, 100 is the default. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_subscribers_get_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChannelSubscriberResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_signals_id_subscribers_get_serialize( self, session_token, id, - **kwargs - ): - """Get the subscribers of a signal # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_signals_id_subscribers_get(session_token, id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - id (str): The id of the signal. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - skip (int): No. of results to skip.. [optional] if omitted the server will use the default value of 0 - limit (int): Max No. of subscribers to return. If no value is provided, 100 is the default.. [optional] if omitted the server will use the default value of 100 - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ChannelSubscriberResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['id'] = \ - id - return self.v1_signals_id_subscribers_get_endpoint.call_with_http_info(**kwargs) - - def v1_signals_id_unsubscribe_post( + key_manager_token, + skip, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/signals/{id}/subscribers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_signals_id_unsubscribe_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + users: Annotated[Optional[List[StrictInt]], Field(description="UserIds to unsubscribe (only for bulk unsubscription)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ChannelSubscriptionResponse: + """Unsubscribe to a Signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param users: UserIds to unsubscribe (only for bulk unsubscription) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_unsubscribe_post_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChannelSubscriptionResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_signals_id_unsubscribe_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + users: Annotated[Optional[List[StrictInt]], Field(description="UserIds to unsubscribe (only for bulk unsubscription)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ChannelSubscriptionResponse]: + """Unsubscribe to a Signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param users: UserIds to unsubscribe (only for bulk unsubscription) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_unsubscribe_post_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChannelSubscriptionResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_signals_id_unsubscribe_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + users: Annotated[Optional[List[StrictInt]], Field(description="UserIds to unsubscribe (only for bulk unsubscription)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Unsubscribe to a Signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param users: UserIds to unsubscribe (only for bulk unsubscription) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_unsubscribe_post_serialize( + session_token=session_token, + id=id, + key_manager_token=key_manager_token, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ChannelSubscriptionResponse", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_signals_id_unsubscribe_post_serialize( self, session_token, id, - **kwargs - ): - """Unsubscribe to a Signal. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_signals_id_unsubscribe_post(session_token, id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - id (str): The id of the signal. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - users ([int]): UserIds to unsubscribe (only for bulk unsubscription). [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ChannelSubscriptionResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['id'] = \ - id - return self.v1_signals_id_unsubscribe_post_endpoint.call_with_http_info(**kwargs) - - def v1_signals_id_update_post( + key_manager_token, + users, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'users': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if users is not None: + _body_params = users + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/signals/{id}/unsubscribe', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_signals_id_update_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + signal: Annotated[BaseSignal, Field(description="Signal definition.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Signal: + """Update a signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param signal: Signal definition. (required) + :type signal: BaseSignal + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_update_post_serialize( + session_token=session_token, + id=id, + signal=signal, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Signal", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_signals_id_update_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + signal: Annotated[BaseSignal, Field(description="Signal definition.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Signal]: + """Update a signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param signal: Signal definition. (required) + :type signal: BaseSignal + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_update_post_serialize( + session_token=session_token, + id=id, + signal=signal, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Signal", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_signals_id_update_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the signal.")], + signal: Annotated[BaseSignal, Field(description="Signal definition.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update a signal. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the signal. (required) + :type id: str + :param signal: Signal definition. (required) + :type signal: BaseSignal + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_id_update_post_serialize( + session_token=session_token, + id=id, + signal=signal, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Signal", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '451': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_signals_id_update_post_serialize( self, session_token, id, signal, - **kwargs - ): - """Update a signal. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_signals_id_update_post(session_token, id, signal, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - id (str): The id of the signal. - signal (BaseSignal): Signal definition. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Signal - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['id'] = \ - id - kwargs['signal'] = \ - signal - return self.v1_signals_id_update_post_endpoint.call_with_http_info(**kwargs) - - def v1_signals_list_get( + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if signal is not None: + _body_params = signal + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/signals/{id}/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_signals_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + skip: Annotated[Optional[StrictInt], Field(description="No. of signals to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of signals to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[Signal]: + """List signals for the requesting user. This includes signals that the user has created and public signals to which they subscribed. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param skip: No. of signals to skip. + :type skip: int + :param limit: Max no. of signals to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_list_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Signal]", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_signals_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + skip: Annotated[Optional[StrictInt], Field(description="No. of signals to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of signals to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[Signal]]: + """List signals for the requesting user. This includes signals that the user has created and public signals to which they subscribed. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param skip: No. of signals to skip. + :type skip: int + :param limit: Max no. of signals to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_list_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Signal]", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_signals_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + skip: Annotated[Optional[StrictInt], Field(description="No. of signals to skip.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of signals to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List signals for the requesting user. This includes signals that the user has created and public signals to which they subscribed. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param skip: No. of signals to skip. + :type skip: int + :param limit: Max no. of signals to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_signals_list_get_serialize( + session_token=session_token, + key_manager_token=key_manager_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Signal]", + '400': "V2Error", + '401': "V2Error", + '403': "V2Error", + '500': "V2Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_signals_list_get_serialize( self, session_token, - **kwargs - ): - """List signals for the requesting user. This includes signals that the user has created and public signals to which they subscribed. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_signals_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - skip (int): No. of signals to skip.. [optional] - limit (int): Max no. of signals to return. If no value is provided, 50 is the default. The maximum supported value is 500. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SignalList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_signals_list_get_endpoint.call_with_http_info(**kwargs) + key_manager_token, + skip, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/signals/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/agent_api/system_api.py b/symphony/bdk/gen/agent_api/system_api.py index b7ed0188..fb4093e3 100644 --- a/symphony/bdk/gen/agent_api/system_api.py +++ b/symphony/bdk/gen/agent_api/system_api.py @@ -1,560 +1,1196 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) +from pydantic import Field, StrictBool, StrictStr +from typing import Optional +from typing_extensions import Annotated from symphony.bdk.gen.agent_model.v1_health_check_response import V1HealthCheckResponse from symphony.bdk.gen.agent_model.v2_health_check_response import V2HealthCheckResponse from symphony.bdk.gen.agent_model.v3_health import V3Health +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class SystemApi(object): + +class SystemApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_health_check_get_endpoint = _Endpoint( - settings={ - 'response_type': (V1HealthCheckResponse,), - 'auth': [], - 'endpoint_path': '/v1/HealthCheck', - 'operation_id': 'v1_health_check_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - }, - 'attribute_map': { - }, - 'location_map': { - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + + + @validate_call + async def v1_health_check_get( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1HealthCheckResponse: + """(Deprecated) Checks the health of the Agent. + + Used to validate the configuration of the agent. Makes a request to the HealthCheck on the Symphony cloud. Makes a request to the HealthCheck on the Key Manager service. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v1/HealthCheck is deprecated.", DeprecationWarning) + + _param = self._v1_health_check_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1HealthCheckResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_health_check_get_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1HealthCheckResponse]: + """(Deprecated) Checks the health of the Agent. + + Used to validate the configuration of the agent. Makes a request to the HealthCheck on the Symphony cloud. Makes a request to the HealthCheck on the Key Manager service. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v1/HealthCheck is deprecated.", DeprecationWarning) + + _param = self._v1_health_check_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1HealthCheckResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_health_check_get_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Checks the health of the Agent. + + Used to validate the configuration of the agent. Makes a request to the HealthCheck on the Symphony cloud. Makes a request to the HealthCheck on the Key Manager service. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v1/HealthCheck is deprecated.", DeprecationWarning) + + _param = self._v1_health_check_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1HealthCheckResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_health_check_get_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v2_health_check_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2HealthCheckResponse,), - 'auth': [], - 'endpoint_path': '/v2/HealthCheck', - 'operation_id': 'v2_health_check_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'show_firehose_errors', - 'fail_on_pod_connectivity', - 'fail_on_key_manager_connectivity', - 'fail_on_agent_service_user', - 'fail_on_ce_service_user', - 'fail_on_encrypt_decrypt_success', - 'fail_on_any', - 'fail_on_datafeed_connectivity', - 'session_token', - 'key_manager_token', - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'show_firehose_errors': - (bool,), - 'fail_on_pod_connectivity': - (bool,), - 'fail_on_key_manager_connectivity': - (bool,), - 'fail_on_agent_service_user': - (bool,), - 'fail_on_ce_service_user': - (bool,), - 'fail_on_encrypt_decrypt_success': - (bool,), - 'fail_on_any': - (bool,), - 'fail_on_datafeed_connectivity': - (bool,), - 'session_token': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'show_firehose_errors': 'showFirehoseErrors', - 'fail_on_pod_connectivity': 'failOnPodConnectivity', - 'fail_on_key_manager_connectivity': 'failOnKeyManagerConnectivity', - 'fail_on_agent_service_user': 'failOnAgentServiceUser', - 'fail_on_ce_service_user': 'failOnCeServiceUser', - 'fail_on_encrypt_decrypt_success': 'failOnEncryptDecryptSuccess', - 'fail_on_any': 'failOnAny', - 'fail_on_datafeed_connectivity': 'failOnDatafeedConnectivity', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'show_firehose_errors': 'query', - 'fail_on_pod_connectivity': 'query', - 'fail_on_key_manager_connectivity': 'query', - 'fail_on_agent_service_user': 'query', - 'fail_on_ce_service_user': 'query', - 'fail_on_encrypt_decrypt_success': 'query', - 'fail_on_any': 'query', - 'fail_on_datafeed_connectivity': 'query', - 'session_token': 'header', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/HealthCheck', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_health_check_get( + self, + show_firehose_errors: Annotated[Optional[StrictBool], Field(description="[deprecated] Firehose Service has never been deployed. However, this request parameter has been kept here for specs backward compatibility. ")] = None, + fail_on_pod_connectivity: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Pod connectivity fails. When set to \"true\", in case of Pod connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_key_manager_connectivity: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Key Manager connectivity fails. When set to \"true\", in case of Key Manager connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_agent_service_user: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Agent Service User connectivity fails. When set to \"true\", in case of Agent Service connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_ce_service_user: Annotated[Optional[StrictBool], Field(description="This query parameter is not used as the ceservice is deprecated and it is kept for backward compatibility. Default value is \"false\" but it will not change the response status code if set to true. ")] = None, + fail_on_encrypt_decrypt_success: Annotated[Optional[StrictBool], Field(description="Defines the status code response whenever the Encrypt/Decrypt message check fails. When set to \"true\", in case of Encrypt or Decrypt failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_any: Annotated[Optional[StrictBool], Field(description="Defines the status code response whenever at least one of the checks fails. When set to \"true\", in case of any failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_datafeed_connectivity: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Datafeed2 connectivity fails. When set to \"true\", in case of Datafeed connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + session_token: Annotated[Optional[StrictStr], Field(description="Session authentication token.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2HealthCheckResponse: + """(Deprecated) Checks the health of the Agent. + + [deprecated] : This endpoint is deprecated. The health check endpoint to be used instead is '/v3/health/extended'. Unlike this deprecated endpoint, the extended health check endpoint provides status on external component such as pod, key manager, ceservice, agentservice... + + :param show_firehose_errors: [deprecated] Firehose Service has never been deployed. However, this request parameter has been kept here for specs backward compatibility. + :type show_firehose_errors: bool + :param fail_on_pod_connectivity: Defines the HealthCheck status code response whenever the Pod connectivity fails. When set to \"true\", in case of Pod connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_pod_connectivity: bool + :param fail_on_key_manager_connectivity: Defines the HealthCheck status code response whenever the Key Manager connectivity fails. When set to \"true\", in case of Key Manager connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_key_manager_connectivity: bool + :param fail_on_agent_service_user: Defines the HealthCheck status code response whenever the Agent Service User connectivity fails. When set to \"true\", in case of Agent Service connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_agent_service_user: bool + :param fail_on_ce_service_user: This query parameter is not used as the ceservice is deprecated and it is kept for backward compatibility. Default value is \"false\" but it will not change the response status code if set to true. + :type fail_on_ce_service_user: bool + :param fail_on_encrypt_decrypt_success: Defines the status code response whenever the Encrypt/Decrypt message check fails. When set to \"true\", in case of Encrypt or Decrypt failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_encrypt_decrypt_success: bool + :param fail_on_any: Defines the status code response whenever at least one of the checks fails. When set to \"true\", in case of any failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_any: bool + :param fail_on_datafeed_connectivity: Defines the HealthCheck status code response whenever the Datafeed2 connectivity fails. When set to \"true\", in case of Datafeed connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_datafeed_connectivity: bool + :param session_token: Session authentication token. + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v2/HealthCheck is deprecated.", DeprecationWarning) + + _param = self._v2_health_check_get_serialize( + show_firehose_errors=show_firehose_errors, + fail_on_pod_connectivity=fail_on_pod_connectivity, + fail_on_key_manager_connectivity=fail_on_key_manager_connectivity, + fail_on_agent_service_user=fail_on_agent_service_user, + fail_on_ce_service_user=fail_on_ce_service_user, + fail_on_encrypt_decrypt_success=fail_on_encrypt_decrypt_success, + fail_on_any=fail_on_any, + fail_on_datafeed_connectivity=fail_on_datafeed_connectivity, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2HealthCheckResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_health_check_get_with_http_info( + self, + show_firehose_errors: Annotated[Optional[StrictBool], Field(description="[deprecated] Firehose Service has never been deployed. However, this request parameter has been kept here for specs backward compatibility. ")] = None, + fail_on_pod_connectivity: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Pod connectivity fails. When set to \"true\", in case of Pod connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_key_manager_connectivity: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Key Manager connectivity fails. When set to \"true\", in case of Key Manager connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_agent_service_user: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Agent Service User connectivity fails. When set to \"true\", in case of Agent Service connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_ce_service_user: Annotated[Optional[StrictBool], Field(description="This query parameter is not used as the ceservice is deprecated and it is kept for backward compatibility. Default value is \"false\" but it will not change the response status code if set to true. ")] = None, + fail_on_encrypt_decrypt_success: Annotated[Optional[StrictBool], Field(description="Defines the status code response whenever the Encrypt/Decrypt message check fails. When set to \"true\", in case of Encrypt or Decrypt failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_any: Annotated[Optional[StrictBool], Field(description="Defines the status code response whenever at least one of the checks fails. When set to \"true\", in case of any failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_datafeed_connectivity: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Datafeed2 connectivity fails. When set to \"true\", in case of Datafeed connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + session_token: Annotated[Optional[StrictStr], Field(description="Session authentication token.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2HealthCheckResponse]: + """(Deprecated) Checks the health of the Agent. + + [deprecated] : This endpoint is deprecated. The health check endpoint to be used instead is '/v3/health/extended'. Unlike this deprecated endpoint, the extended health check endpoint provides status on external component such as pod, key manager, ceservice, agentservice... + + :param show_firehose_errors: [deprecated] Firehose Service has never been deployed. However, this request parameter has been kept here for specs backward compatibility. + :type show_firehose_errors: bool + :param fail_on_pod_connectivity: Defines the HealthCheck status code response whenever the Pod connectivity fails. When set to \"true\", in case of Pod connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_pod_connectivity: bool + :param fail_on_key_manager_connectivity: Defines the HealthCheck status code response whenever the Key Manager connectivity fails. When set to \"true\", in case of Key Manager connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_key_manager_connectivity: bool + :param fail_on_agent_service_user: Defines the HealthCheck status code response whenever the Agent Service User connectivity fails. When set to \"true\", in case of Agent Service connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_agent_service_user: bool + :param fail_on_ce_service_user: This query parameter is not used as the ceservice is deprecated and it is kept for backward compatibility. Default value is \"false\" but it will not change the response status code if set to true. + :type fail_on_ce_service_user: bool + :param fail_on_encrypt_decrypt_success: Defines the status code response whenever the Encrypt/Decrypt message check fails. When set to \"true\", in case of Encrypt or Decrypt failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_encrypt_decrypt_success: bool + :param fail_on_any: Defines the status code response whenever at least one of the checks fails. When set to \"true\", in case of any failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_any: bool + :param fail_on_datafeed_connectivity: Defines the HealthCheck status code response whenever the Datafeed2 connectivity fails. When set to \"true\", in case of Datafeed connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_datafeed_connectivity: bool + :param session_token: Session authentication token. + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v2/HealthCheck is deprecated.", DeprecationWarning) + + _param = self._v2_health_check_get_serialize( + show_firehose_errors=show_firehose_errors, + fail_on_pod_connectivity=fail_on_pod_connectivity, + fail_on_key_manager_connectivity=fail_on_key_manager_connectivity, + fail_on_agent_service_user=fail_on_agent_service_user, + fail_on_ce_service_user=fail_on_ce_service_user, + fail_on_encrypt_decrypt_success=fail_on_encrypt_decrypt_success, + fail_on_any=fail_on_any, + fail_on_datafeed_connectivity=fail_on_datafeed_connectivity, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2HealthCheckResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_health_check_get_without_preload_content( + self, + show_firehose_errors: Annotated[Optional[StrictBool], Field(description="[deprecated] Firehose Service has never been deployed. However, this request parameter has been kept here for specs backward compatibility. ")] = None, + fail_on_pod_connectivity: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Pod connectivity fails. When set to \"true\", in case of Pod connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_key_manager_connectivity: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Key Manager connectivity fails. When set to \"true\", in case of Key Manager connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_agent_service_user: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Agent Service User connectivity fails. When set to \"true\", in case of Agent Service connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_ce_service_user: Annotated[Optional[StrictBool], Field(description="This query parameter is not used as the ceservice is deprecated and it is kept for backward compatibility. Default value is \"false\" but it will not change the response status code if set to true. ")] = None, + fail_on_encrypt_decrypt_success: Annotated[Optional[StrictBool], Field(description="Defines the status code response whenever the Encrypt/Decrypt message check fails. When set to \"true\", in case of Encrypt or Decrypt failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_any: Annotated[Optional[StrictBool], Field(description="Defines the status code response whenever at least one of the checks fails. When set to \"true\", in case of any failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + fail_on_datafeed_connectivity: Annotated[Optional[StrictBool], Field(description="Defines the HealthCheck status code response whenever the Datafeed2 connectivity fails. When set to \"true\", in case of Datafeed connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". ")] = None, + session_token: Annotated[Optional[StrictStr], Field(description="Session authentication token.")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Checks the health of the Agent. + + [deprecated] : This endpoint is deprecated. The health check endpoint to be used instead is '/v3/health/extended'. Unlike this deprecated endpoint, the extended health check endpoint provides status on external component such as pod, key manager, ceservice, agentservice... + + :param show_firehose_errors: [deprecated] Firehose Service has never been deployed. However, this request parameter has been kept here for specs backward compatibility. + :type show_firehose_errors: bool + :param fail_on_pod_connectivity: Defines the HealthCheck status code response whenever the Pod connectivity fails. When set to \"true\", in case of Pod connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_pod_connectivity: bool + :param fail_on_key_manager_connectivity: Defines the HealthCheck status code response whenever the Key Manager connectivity fails. When set to \"true\", in case of Key Manager connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_key_manager_connectivity: bool + :param fail_on_agent_service_user: Defines the HealthCheck status code response whenever the Agent Service User connectivity fails. When set to \"true\", in case of Agent Service connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_agent_service_user: bool + :param fail_on_ce_service_user: This query parameter is not used as the ceservice is deprecated and it is kept for backward compatibility. Default value is \"false\" but it will not change the response status code if set to true. + :type fail_on_ce_service_user: bool + :param fail_on_encrypt_decrypt_success: Defines the status code response whenever the Encrypt/Decrypt message check fails. When set to \"true\", in case of Encrypt or Decrypt failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_encrypt_decrypt_success: bool + :param fail_on_any: Defines the status code response whenever at least one of the checks fails. When set to \"true\", in case of any failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_any: bool + :param fail_on_datafeed_connectivity: Defines the HealthCheck status code response whenever the Datafeed2 connectivity fails. When set to \"true\", in case of Datafeed connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". + :type fail_on_datafeed_connectivity: bool + :param session_token: Session authentication token. + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("GET /v2/HealthCheck is deprecated.", DeprecationWarning) + + _param = self._v2_health_check_get_serialize( + show_firehose_errors=show_firehose_errors, + fail_on_pod_connectivity=fail_on_pod_connectivity, + fail_on_key_manager_connectivity=fail_on_key_manager_connectivity, + fail_on_agent_service_user=fail_on_agent_service_user, + fail_on_ce_service_user=fail_on_ce_service_user, + fail_on_encrypt_decrypt_success=fail_on_encrypt_decrypt_success, + fail_on_any=fail_on_any, + fail_on_datafeed_connectivity=fail_on_datafeed_connectivity, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2HealthCheckResponse", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_health_check_get_serialize( + self, + show_firehose_errors, + fail_on_pod_connectivity, + fail_on_key_manager_connectivity, + fail_on_agent_service_user, + fail_on_ce_service_user, + fail_on_encrypt_decrypt_success, + fail_on_any, + fail_on_datafeed_connectivity, + session_token, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if show_firehose_errors is not None: + + _query_params.append(('showFirehoseErrors', show_firehose_errors)) + + if fail_on_pod_connectivity is not None: + + _query_params.append(('failOnPodConnectivity', fail_on_pod_connectivity)) + + if fail_on_key_manager_connectivity is not None: + + _query_params.append(('failOnKeyManagerConnectivity', fail_on_key_manager_connectivity)) + + if fail_on_agent_service_user is not None: + + _query_params.append(('failOnAgentServiceUser', fail_on_agent_service_user)) + + if fail_on_ce_service_user is not None: + + _query_params.append(('failOnCeServiceUser', fail_on_ce_service_user)) + + if fail_on_encrypt_decrypt_success is not None: + + _query_params.append(('failOnEncryptDecryptSuccess', fail_on_encrypt_decrypt_success)) + + if fail_on_any is not None: + + _query_params.append(('failOnAny', fail_on_any)) + + if fail_on_datafeed_connectivity is not None: + + _query_params.append(('failOnDatafeedConnectivity', fail_on_datafeed_connectivity)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_extended_health_endpoint = _Endpoint( - settings={ - 'response_type': (V3Health,), - 'auth': [], - 'endpoint_path': '/v3/health/extended', - 'operation_id': 'v3_extended_health', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - }, - 'attribute_map': { - }, - 'location_map': { - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/HealthCheck', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_extended_health( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3Health: + """Checks health status of services and users + + _Available on Agent 2.57.0 and above._ Returns the connectivity status of the Agent services (**pod**, **key manager** and **datafeed**) as well as users connectivity (**agentservice** and **ceservice**). The global status will be set to `DOWN` if at least one of the sub-status is also `DOWN`. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_extended_health_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3Health", + '503': "V3Health", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_extended_health_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3Health]: + """Checks health status of services and users + + _Available on Agent 2.57.0 and above._ Returns the connectivity status of the Agent services (**pod**, **key manager** and **datafeed**) as well as users connectivity (**agentservice** and **ceservice**). The global status will be set to `DOWN` if at least one of the sub-status is also `DOWN`. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_extended_health_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3Health", + '503': "V3Health", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_extended_health_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Checks health status of services and users + + _Available on Agent 2.57.0 and above._ Returns the connectivity status of the Agent services (**pod**, **key manager** and **datafeed**) as well as users connectivity (**agentservice** and **ceservice**). The global status will be set to `DOWN` if at least one of the sub-status is also `DOWN`. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_extended_health_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3Health", + '503': "V3Health", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_extended_health_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_health_endpoint = _Endpoint( - settings={ - 'response_type': (V3Health,), - 'auth': [], - 'endpoint_path': '/v3/health', - 'operation_id': 'v3_health', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - }, - 'attribute_map': { - }, - 'location_map': { - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/health/extended', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def v1_health_check_get( + + + + @validate_call + async def v3_health( self, - **kwargs - ): - """Checks the health of the Agent. # noqa: E501 - - Used to validate the configuration of the agent. Makes a request to the HealthCheck on the Symphony cloud. Makes a request to the HealthCheck on the Key Manager service. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_health_check_get(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1HealthCheckResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.v1_health_check_get_endpoint.call_with_http_info(**kwargs) - - def v2_health_check_get( + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3Health: + """Checks health status + + _Available on Agent 2.57.0 and above._ Returns the connectivity status of your Agent server. If your Agent server is started and running, the status value will be `UP` + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_health_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3Health", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_health_with_http_info( self, - **kwargs - ): - """Checks the health of the Agent. # noqa: E501 - - [deprecated] : This endpoint is deprecated. The health check endpoint to be used instead is '/v3/health/extended'. Unlike this deprecated endpoint, the extended health check endpoint provides status on external component such as pod, key manager, ceservice, agentservice... # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v2_health_check_get(async_req=True) - >>> result = thread.get() - - - Keyword Args: - show_firehose_errors (bool): [deprecated] Firehose Service has never been deployed. However, this request parameter has been kept here for specs backward compatibility. . [optional] - fail_on_pod_connectivity (bool): Defines the HealthCheck status code response whenever the Pod connectivity fails. When set to \"true\", in case of Pod connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". . [optional] - fail_on_key_manager_connectivity (bool): Defines the HealthCheck status code response whenever the Key Manager connectivity fails. When set to \"true\", in case of Key Manager connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". . [optional] - fail_on_agent_service_user (bool): Defines the HealthCheck status code response whenever the Agent Service User connectivity fails. When set to \"true\", in case of Agent Service connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". . [optional] - fail_on_ce_service_user (bool): This query parameter is not used as the ceservice is deprecated and it is kept for backward compatibility. Default value is \"false\" but it will not change the response status code if set to true. . [optional] - fail_on_encrypt_decrypt_success (bool): Defines the status code response whenever the Encrypt/Decrypt message check fails. When set to \"true\", in case of Encrypt or Decrypt failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". . [optional] - fail_on_any (bool): Defines the status code response whenever at least one of the checks fails. When set to \"true\", in case of any failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". . [optional] - fail_on_datafeed_connectivity (bool): Defines the HealthCheck status code response whenever the Datafeed2 connectivity fails. When set to \"true\", in case of Datafeed connectivity failure, the response status code will be 503; otherwise, it will be 200. Default value is \"false\". . [optional] - session_token (str): Session authentication token.. [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2HealthCheckResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.v2_health_check_get_endpoint.call_with_http_info(**kwargs) - - def v3_extended_health( + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3Health]: + """Checks health status + + _Available on Agent 2.57.0 and above._ Returns the connectivity status of your Agent server. If your Agent server is started and running, the status value will be `UP` + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_health_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3Health", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_health_without_preload_content( self, - **kwargs - ): - """Checks health status of services and users # noqa: E501 - - _Available on Agent 2.57.0 and above._ Returns the connectivity status of the Agent services (**pod**, **key manager** and **datafeed**) as well as users connectivity (**agentservice** and **ceservice**). The global status will be set to `DOWN` if at least one of the sub-status is also `DOWN`. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_extended_health(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3Health - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.v3_extended_health_endpoint.call_with_http_info(**kwargs) - - def v3_health( + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Checks health status + + _Available on Agent 2.57.0 and above._ Returns the connectivity status of your Agent server. If your Agent server is started and running, the status value will be `UP` + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_health_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3Health", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_health_serialize( self, - **kwargs - ): - """Checks health status # noqa: E501 - - _Available on Agent 2.57.0 and above._ Returns the connectivity status of your Agent server. If your Agent server is started and running, the status value will be `UP` # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_health(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3Health - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.v3_health_endpoint.call_with_http_info(**kwargs) + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/health', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/agent_api/util_api.py b/symphony/bdk/gen/agent_api/util_api.py index cc20e6ea..cac9f1c4 100644 --- a/symphony/bdk/gen/agent_api/util_api.py +++ b/symphony/bdk/gen/agent_api/util_api.py @@ -1,325 +1,669 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.agent_model.error import Error +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated from symphony.bdk.gen.agent_model.simple_message import SimpleMessage +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class UtilApi(object): +class UtilApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_util_echo_post_endpoint = _Endpoint( - settings={ - 'response_type': (SimpleMessage,), - 'auth': [], - 'endpoint_path': '/v1/util/echo', - 'operation_id': 'v1_util_echo_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'echo_input', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'echo_input', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'echo_input': - (SimpleMessage,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'echo_input': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_util_obsolete_post_endpoint = _Endpoint( - settings={ - 'response_type': (SimpleMessage,), - 'auth': [], - 'endpoint_path': '/v1/util/obsolete', - 'operation_id': 'v1_util_obsolete_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'echo_input', - 'key_manager_token', - ], - 'required': [ - 'session_token', - 'echo_input', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'echo_input': - (SimpleMessage,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'session_token': 'header', - 'echo_input': 'body', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - def v1_util_echo_post( + + @validate_call + async def v1_util_echo_post( self, - session_token, - echo_input, - **kwargs - ): - """Test endpoint, returns input. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_util_echo_post(session_token, echo_input, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - echo_input (SimpleMessage): Message in plain text - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SimpleMessage - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + echo_input: Annotated[SimpleMessage, Field(description="Message in plain text")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SimpleMessage: + """Test endpoint, returns input. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param echo_input: Message in plain text (required) + :type echo_input: SimpleMessage + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_util_echo_post_serialize( + session_token=session_token, + echo_input=echo_input, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SimpleMessage", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_util_echo_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + echo_input: Annotated[SimpleMessage, Field(description="Message in plain text")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SimpleMessage]: + """Test endpoint, returns input. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param echo_input: Message in plain text (required) + :type echo_input: SimpleMessage + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_util_echo_post_serialize( + session_token=session_token, + echo_input=echo_input, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SimpleMessage", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_util_echo_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + echo_input: Annotated[SimpleMessage, Field(description="Message in plain text")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Test endpoint, returns input. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param echo_input: Message in plain text (required) + :type echo_input: SimpleMessage + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_util_echo_post_serialize( + session_token=session_token, + echo_input=echo_input, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SimpleMessage", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['echo_input'] = \ - echo_input - return self.v1_util_echo_post_endpoint.call_with_http_info(**kwargs) - - def v1_util_obsolete_post( + return response_data.response + + + def _v1_util_echo_post_serialize( self, session_token, echo_input, - **kwargs - ): - """Example of a deprecated endpoint, returns input. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_util_obsolete_post(session_token, echo_input, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - echo_input (SimpleMessage): Message in plain text - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SimpleMessage - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if echo_input is not None: + _body_params = echo_input + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/util/echo', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def v1_util_obsolete_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + echo_input: Annotated[SimpleMessage, Field(description="Message in plain text")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SimpleMessage: + """(Deprecated) Example of a deprecated endpoint, returns input. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param echo_input: Message in plain text (required) + :type echo_input: SimpleMessage + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/util/obsolete is deprecated.", DeprecationWarning) + + _param = self._v1_util_obsolete_post_serialize( + session_token=session_token, + echo_input=echo_input, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SimpleMessage", + '400': "Error", + '401': "Error", + '403': "Error", + '420': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_util_obsolete_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + echo_input: Annotated[SimpleMessage, Field(description="Message in plain text")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SimpleMessage]: + """(Deprecated) Example of a deprecated endpoint, returns input. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param echo_input: Message in plain text (required) + :type echo_input: SimpleMessage + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/util/obsolete is deprecated.", DeprecationWarning) + + _param = self._v1_util_obsolete_post_serialize( + session_token=session_token, + echo_input=echo_input, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SimpleMessage", + '400': "Error", + '401': "Error", + '403': "Error", + '420': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + + @validate_call + async def v1_util_obsolete_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + echo_input: Annotated[SimpleMessage, Field(description="Message in plain text")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Example of a deprecated endpoint, returns input. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param echo_input: Message in plain text (required) + :type echo_input: SimpleMessage + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/util/obsolete is deprecated.", DeprecationWarning) + + _param = self._v1_util_obsolete_post_serialize( + session_token=session_token, + echo_input=echo_input, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SimpleMessage", + '400': "Error", + '401': "Error", + '403': "Error", + '420': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_util_obsolete_post_serialize( + self, + session_token, + echo_input, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + if echo_input is not None: + _body_params = echo_input + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/util/obsolete', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['echo_input'] = \ - echo_input - return self.v1_util_obsolete_post_endpoint.call_with_http_info(**kwargs) + diff --git a/symphony/bdk/gen/agent_api/violations_api.py b/symphony/bdk/gen/agent_api/violations_api.py index d7b291d5..fe753ea8 100644 --- a/symphony/bdk/gen/agent_api/violations_api.py +++ b/symphony/bdk/gen/agent_api/violations_api.py @@ -1,27 +1,24 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.agent_model.error import Error +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBytes, StrictInt, StrictStr +from typing import Optional, Union +from typing_extensions import Annotated from symphony.bdk.gen.agent_model.v1_dlp_violation_message_response import V1DLPViolationMessageResponse from symphony.bdk.gen.agent_model.v1_dlp_violation_signal_response import V1DLPViolationSignalResponse from symphony.bdk.gen.agent_model.v1_dlp_violation_stream_response import V1DLPViolationStreamResponse @@ -29,1132 +26,2482 @@ from symphony.bdk.gen.agent_model.v3_dlp_violation_signal_response import V3DLPViolationSignalResponse from symphony.bdk.gen.agent_model.v3_dlp_violation_stream_response import V3DLPViolationStreamResponse +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class ViolationsApi(object): +class ViolationsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_dlp_violations_message_get_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPViolationMessageResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/violations/message', - 'operation_id': 'v1_dlp_violations_message_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'start_time', - 'session_token', - 'end_time', - 'next', - 'limit', - 'key_manager_token', - ], - 'required': [ - 'start_time', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'start_time': - (int,), - 'session_token': - (str,), - 'end_time': - (int,), - 'next': - (str,), - 'limit': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'start_time': 'startTime', - 'session_token': 'sessionToken', - 'end_time': 'endTime', - 'next': 'next', - 'limit': 'limit', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'start_time': 'query', - 'session_token': 'header', - 'end_time': 'query', - 'next': 'query', - 'limit': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + + + @validate_call + async def v1_dlp_violations_message_get( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPViolationMessageResponse: + """Get violations as a result of policy enforcement on messages. + + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_violations_message_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - self.v1_dlp_violations_signal_get_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPViolationSignalResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/violations/signal', - 'operation_id': 'v1_dlp_violations_signal_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'start_time', - 'session_token', - 'end_time', - 'next', - 'limit', - 'key_manager_token', - ], - 'required': [ - 'start_time', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'start_time': - (int,), - 'session_token': - (str,), - 'end_time': - (int,), - 'next': - (str,), - 'limit': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'start_time': 'startTime', - 'session_token': 'sessionToken', - 'end_time': 'endTime', - 'next': 'next', - 'limit': 'limit', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'start_time': 'query', - 'session_token': 'header', - 'end_time': 'query', - 'next': 'query', - 'limit': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPViolationMessageResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - self.v1_dlp_violations_stream_get_endpoint = _Endpoint( - settings={ - 'response_type': (V1DLPViolationStreamResponse,), - 'auth': [], - 'endpoint_path': '/v1/dlp/violations/stream', - 'operation_id': 'v1_dlp_violations_stream_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'start_time', - 'session_token', - 'end_time', - 'next', - 'limit', - 'key_manager_token', - ], - 'required': [ - 'start_time', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'start_time': - (int,), - 'session_token': - (str,), - 'end_time': - (int,), - 'next': - (str,), - 'limit': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'start_time': 'startTime', - 'session_token': 'sessionToken', - 'end_time': 'endTime', - 'next': 'next', - 'limit': 'limit', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'start_time': 'query', - 'session_token': 'header', - 'end_time': 'query', - 'next': 'query', - 'limit': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_violations_message_get_with_http_info( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPViolationMessageResponse]: + """Get violations as a result of policy enforcement on messages. + + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_violations_message_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - self.v3_dlp_violation_attachment_get_endpoint = _Endpoint( - settings={ - 'response_type': (str,), - 'auth': [], - 'endpoint_path': '/v3/dlp/violation/attachment', - 'operation_id': 'v3_dlp_violation_attachment_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'file_id', - 'violation_id', - 'session_token', - 'key_manager_token', - ], - 'required': [ - 'file_id', - 'violation_id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'file_id': - (str,), - 'violation_id': - (str,), - 'session_token': - (str,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'file_id': 'fileId', - 'violation_id': 'violationId', - 'session_token': 'sessionToken', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'file_id': 'query', - 'violation_id': 'query', - 'session_token': 'header', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/octet-stream' - ], - 'content_type': [], - }, - api_client=api_client + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPViolationMessageResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - self.v3_dlp_violations_message_get_endpoint = _Endpoint( - settings={ - 'response_type': (V3DLPViolationMessageResponse,), - 'auth': [], - 'endpoint_path': '/v3/dlp/violations/message', - 'operation_id': 'v3_dlp_violations_message_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'start_time', - 'session_token', - 'end_time', - 'next', - 'limit', - 'key_manager_token', - ], - 'required': [ - 'start_time', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'start_time': - (int,), - 'session_token': - (str,), - 'end_time': - (int,), - 'next': - (str,), - 'limit': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'start_time': 'startTime', - 'session_token': 'sessionToken', - 'end_time': 'endTime', - 'next': 'next', - 'limit': 'limit', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'start_time': 'query', - 'session_token': 'header', - 'end_time': 'query', - 'next': 'query', - 'limit': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - self.v3_dlp_violations_signal_get_endpoint = _Endpoint( - settings={ - 'response_type': (V3DLPViolationSignalResponse,), - 'auth': [], - 'endpoint_path': '/v3/dlp/violations/signal', - 'operation_id': 'v3_dlp_violations_signal_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'start_time', - 'session_token', - 'end_time', - 'next', - 'limit', - 'key_manager_token', - ], - 'required': [ - 'start_time', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'start_time': - (int,), - 'session_token': - (str,), - 'end_time': - (int,), - 'next': - (str,), - 'limit': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'start_time': 'startTime', - 'session_token': 'sessionToken', - 'end_time': 'endTime', - 'next': 'next', - 'limit': 'limit', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'start_time': 'query', - 'session_token': 'header', - 'end_time': 'query', - 'next': 'query', - 'limit': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + + + @validate_call + async def v1_dlp_violations_message_get_without_preload_content( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get violations as a result of policy enforcement on messages. + + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_violations_message_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - self.v3_dlp_violations_stream_get_endpoint = _Endpoint( - settings={ - 'response_type': (V3DLPViolationStreamResponse,), - 'auth': [], - 'endpoint_path': '/v3/dlp/violations/stream', - 'operation_id': 'v3_dlp_violations_stream_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'start_time', - 'session_token', - 'end_time', - 'next', - 'limit', - 'key_manager_token', - ], - 'required': [ - 'start_time', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'start_time': - (int,), - 'session_token': - (str,), - 'end_time': - (int,), - 'next': - (str,), - 'limit': - (int,), - 'key_manager_token': - (str,), - }, - 'attribute_map': { - 'start_time': 'startTime', - 'session_token': 'sessionToken', - 'end_time': 'endTime', - 'next': 'next', - 'limit': 'limit', - 'key_manager_token': 'keyManagerToken', - }, - 'location_map': { - 'start_time': 'query', - 'session_token': 'header', - 'end_time': 'query', - 'next': 'query', - 'limit': 'query', - 'key_manager_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPViolationMessageResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response + - def v1_dlp_violations_message_get( + def _v1_dlp_violations_message_get_serialize( self, start_time, session_token, - **kwargs - ): - """Get violations as a result of policy enforcement on messages. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_violations_message_get(start_time, session_token, async_req=True) - >>> result = thread.get() - - Args: - start_time (int): Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 - session_token (str): Session authentication token. - - Keyword Args: - end_time (int): Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. . [optional] - next (str): Offset of the next chunk of violations. Value is null for the first request.. [optional] - limit (int): Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. . [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPViolationMessageResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + end_time, + next, + limit, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if start_time is not None: + + _query_params.append(('startTime', start_time)) + + if end_time is not None: + + _query_params.append(('endTime', end_time)) + + if next is not None: + + _query_params.append(('next', next)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/dlp/violations/message', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def v1_dlp_violations_signal_get( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPViolationSignalResponse: + """Get violations as a result of policy enforcement on signals. + + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_violations_signal_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPViolationSignalResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_violations_signal_get_with_http_info( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPViolationSignalResponse]: + """Get violations as a result of policy enforcement on signals. + + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_violations_signal_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPViolationSignalResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + + @validate_call + async def v1_dlp_violations_signal_get_without_preload_content( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get violations as a result of policy enforcement on signals. + + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_violations_signal_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPViolationSignalResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['start_time'] = \ - start_time - kwargs['session_token'] = \ - session_token - return self.v1_dlp_violations_message_get_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_violations_signal_get( + return response_data.response + + + def _v1_dlp_violations_signal_get_serialize( self, start_time, session_token, - **kwargs - ): - """Get violations as a result of policy enforcement on signals. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_violations_signal_get(start_time, session_token, async_req=True) - >>> result = thread.get() - - Args: - start_time (int): Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 - session_token (str): Session authentication token. - - Keyword Args: - end_time (int): Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. . [optional] - next (str): Offset of the next chunk of violations. Value is null for the first request.. [optional] - limit (int): Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. . [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPViolationSignalResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + end_time, + next, + limit, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if start_time is not None: + + _query_params.append(('startTime', start_time)) + + if end_time is not None: + + _query_params.append(('endTime', end_time)) + + if next is not None: + + _query_params.append(('next', next)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/dlp/violations/signal', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def v1_dlp_violations_stream_get( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1DLPViolationStreamResponse: + """Get violations as a result of policy enforcement on streams. + + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_violations_stream_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPViolationStreamResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_dlp_violations_stream_get_with_http_info( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1DLPViolationStreamResponse]: + """Get violations as a result of policy enforcement on streams. + + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_violations_stream_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPViolationStreamResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_dlp_violations_stream_get_without_preload_content( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get violations as a result of policy enforcement on streams. + + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_dlp_violations_stream_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1DLPViolationStreamResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['start_time'] = \ - start_time - kwargs['session_token'] = \ - session_token - return self.v1_dlp_violations_signal_get_endpoint.call_with_http_info(**kwargs) - - def v1_dlp_violations_stream_get( + return response_data.response + + + def _v1_dlp_violations_stream_get_serialize( self, start_time, session_token, - **kwargs - ): - """Get violations as a result of policy enforcement on streams. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v1_dlp_violations_stream_get(start_time, session_token, async_req=True) - >>> result = thread.get() - - Args: - start_time (int): Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 - session_token (str): Session authentication token. - - Keyword Args: - end_time (int): Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. . [optional] - next (str): Offset of the next chunk of violations. Value is null for the first request.. [optional] - limit (int): Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. . [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1DLPViolationStreamResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + end_time, + next, + limit, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if start_time is not None: + + _query_params.append(('startTime', start_time)) + + if end_time is not None: + + _query_params.append(('endTime', end_time)) + + if next is not None: + + _query_params.append(('next', next)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/dlp/violations/stream', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def v3_dlp_violation_attachment_get( + self, + file_id: Annotated[StrictStr, Field(description="ID of attachment that will be downloaded.")], + violation_id: Annotated[StrictStr, Field(description="ID of violation that corresponds to the flagged message that contains the attachment")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> bytearray: + """Get attachments that were sent as part of messages that were flagged by the DLP System. + + Retrieves attachments from related message violations as a base64 encoded String. + + :param file_id: ID of attachment that will be downloaded. (required) + :type file_id: str + :param violation_id: ID of violation that corresponds to the flagged message that contains the attachment (required) + :type violation_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violation_attachment_get_serialize( + file_id=file_id, + violation_id=violation_id, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_dlp_violation_attachment_get_with_http_info( + self, + file_id: Annotated[StrictStr, Field(description="ID of attachment that will be downloaded.")], + violation_id: Annotated[StrictStr, Field(description="ID of violation that corresponds to the flagged message that contains the attachment")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[bytearray]: + """Get attachments that were sent as part of messages that were flagged by the DLP System. + + Retrieves attachments from related message violations as a base64 encoded String. + + :param file_id: ID of attachment that will be downloaded. (required) + :type file_id: str + :param violation_id: ID of violation that corresponds to the flagged message that contains the attachment (required) + :type violation_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violation_attachment_get_serialize( + file_id=file_id, + violation_id=violation_id, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + + @validate_call + async def v3_dlp_violation_attachment_get_without_preload_content( + self, + file_id: Annotated[StrictStr, Field(description="ID of attachment that will be downloaded.")], + violation_id: Annotated[StrictStr, Field(description="ID of violation that corresponds to the flagged message that contains the attachment")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get attachments that were sent as part of messages that were flagged by the DLP System. + + Retrieves attachments from related message violations as a base64 encoded String. + + :param file_id: ID of attachment that will be downloaded. (required) + :type file_id: str + :param violation_id: ID of violation that corresponds to the flagged message that contains the attachment (required) + :type violation_id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violation_attachment_get_serialize( + file_id=file_id, + violation_id=violation_id, + session_token=session_token, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "bytearray", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['start_time'] = \ - start_time - kwargs['session_token'] = \ - session_token - return self.v1_dlp_violations_stream_get_endpoint.call_with_http_info(**kwargs) - - def v3_dlp_violation_attachment_get( + return response_data.response + + + def _v3_dlp_violation_attachment_get_serialize( self, file_id, violation_id, session_token, - **kwargs - ): - """Get attachments that were sent as part of messages that were flagged by the DLP System. # noqa: E501 - - Retrieves attachments from related message violations as a base64 encoded String. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_dlp_violation_attachment_get(file_id, violation_id, session_token, async_req=True) - >>> result = thread.get() - - Args: - file_id (str): ID of attachment that will be downloaded. - violation_id (str): ID of violation that corresponds to the flagged message that contains the attachment - session_token (str): Session authentication token. - - Keyword Args: - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - str - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if file_id is not None: + + _query_params.append(('fileId', file_id)) + + if violation_id is not None: + + _query_params.append(('violationId', violation_id)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/octet-stream' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/dlp/violation/attachment', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def v3_dlp_violations_message_get( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3DLPViolationMessageResponse: + """Get violations as a result of policy enforcement on messages. + + Retrieves DLP v3 message related violations for a given time range + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violations_message_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPViolationMessageResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_dlp_violations_message_get_with_http_info( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3DLPViolationMessageResponse]: + """Get violations as a result of policy enforcement on messages. + + Retrieves DLP v3 message related violations for a given time range + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violations_message_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPViolationMessageResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v3_dlp_violations_message_get_without_preload_content( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get violations as a result of policy enforcement on messages. + + Retrieves DLP v3 message related violations for a given time range + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violations_message_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPViolationMessageResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['file_id'] = \ - file_id - kwargs['violation_id'] = \ - violation_id - kwargs['session_token'] = \ - session_token - return self.v3_dlp_violation_attachment_get_endpoint.call_with_http_info(**kwargs) - - def v3_dlp_violations_message_get( + return response_data.response + + + def _v3_dlp_violations_message_get_serialize( self, start_time, session_token, - **kwargs - ): - """Get violations as a result of policy enforcement on messages. # noqa: E501 - - Retrieves DLP v3 message related violations for a given time range # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_dlp_violations_message_get(start_time, session_token, async_req=True) - >>> result = thread.get() - - Args: - start_time (int): Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 - session_token (str): Session authentication token. - - Keyword Args: - end_time (int): Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. . [optional] - next (str): Offset of the next chunk of violations. Value is null for the first request.. [optional] - limit (int): Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. . [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3DLPViolationMessageResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + end_time, + next, + limit, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if start_time is not None: + + _query_params.append(('startTime', start_time)) + + if end_time is not None: + + _query_params.append(('endTime', end_time)) + + if next is not None: + + _query_params.append(('next', next)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/dlp/violations/message', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def v3_dlp_violations_signal_get( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3DLPViolationSignalResponse: + """Get violations as a result of policy enforcement on signals. + + Retrieves DLP v3 signal related violations for a given time range + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violations_signal_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPViolationSignalResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_dlp_violations_signal_get_with_http_info( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3DLPViolationSignalResponse]: + """Get violations as a result of policy enforcement on signals. + + Retrieves DLP v3 signal related violations for a given time range + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violations_signal_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPViolationSignalResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v3_dlp_violations_signal_get_without_preload_content( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get violations as a result of policy enforcement on signals. + + Retrieves DLP v3 signal related violations for a given time range + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violations_signal_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPViolationSignalResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['start_time'] = \ - start_time - kwargs['session_token'] = \ - session_token - return self.v3_dlp_violations_message_get_endpoint.call_with_http_info(**kwargs) - - def v3_dlp_violations_signal_get( + return response_data.response + + + def _v3_dlp_violations_signal_get_serialize( self, start_time, session_token, - **kwargs - ): - """Get violations as a result of policy enforcement on signals. # noqa: E501 - - Retrieves DLP v3 signal related violations for a given time range # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_dlp_violations_signal_get(start_time, session_token, async_req=True) - >>> result = thread.get() - - Args: - start_time (int): Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 - session_token (str): Session authentication token. - - Keyword Args: - end_time (int): Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. . [optional] - next (str): Offset of the next chunk of violations. Value is null for the first request.. [optional] - limit (int): Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. . [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3DLPViolationSignalResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + end_time, + next, + limit, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if start_time is not None: + + _query_params.append(('startTime', start_time)) + + if end_time is not None: + + _query_params.append(('endTime', end_time)) + + if next is not None: + + _query_params.append(('next', next)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/dlp/violations/signal', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_dlp_violations_stream_get( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3DLPViolationStreamResponse: + """Get violations as a result of policy enforcement on streams. + + Retrieves DLP v3 signal related violations for a given time range + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violations_stream_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPViolationStreamResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_dlp_violations_stream_get_with_http_info( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3DLPViolationStreamResponse]: + """Get violations as a result of policy enforcement on streams. + + Retrieves DLP v3 signal related violations for a given time range + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violations_stream_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPViolationStreamResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v3_dlp_violations_stream_get_without_preload_content( + self, + start_time: Annotated[StrictInt, Field(description="Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + end_time: Annotated[Optional[StrictInt], Field(description="Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. ")] = None, + next: Annotated[Optional[StrictStr], Field(description="Offset of the next chunk of violations. Value is null for the first request.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. ")] = None, + key_manager_token: Annotated[Optional[StrictStr], Field(description="Key Manager authentication token.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get violations as a result of policy enforcement on streams. + + Retrieves DLP v3 signal related violations for a given time range + + :param start_time: Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 (required) + :type start_time: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param end_time: Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. + :type end_time: int + :param next: Offset of the next chunk of violations. Value is null for the first request. + :type next: str + :param limit: Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. + :type limit: int + :param key_manager_token: Key Manager authentication token. + :type key_manager_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_dlp_violations_stream_get_serialize( + start_time=start_time, + session_token=session_token, + end_time=end_time, + next=next, + limit=limit, + key_manager_token=key_manager_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3DLPViolationStreamResponse", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['start_time'] = \ - start_time - kwargs['session_token'] = \ - session_token - return self.v3_dlp_violations_signal_get_endpoint.call_with_http_info(**kwargs) - - def v3_dlp_violations_stream_get( + return response_data.response + + + def _v3_dlp_violations_stream_get_serialize( self, start_time, session_token, - **kwargs - ): - """Get violations as a result of policy enforcement on streams. # noqa: E501 - - Retrieves DLP v3 signal related violations for a given time range # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = agent_api.v3_dlp_violations_stream_get(start_time, session_token, async_req=True) - >>> result = thread.get() - - Args: - start_time (int): Timestamp of the first required violation. This is a long integer value representing milliseconds since Jan 1 1970 - session_token (str): Session authentication token. - - Keyword Args: - end_time (int): Timestamp of the last required violation. This is a long integer value representing milliseconds since Jan 1 1970 If unspecified, it will default to current time of the request. . [optional] - next (str): Offset of the next chunk of violations. Value is null for the first request.. [optional] - limit (int): Max No. of violations to return. If no value is provided, 50 is the default. The maximum supported value is 500. . [optional] - key_manager_token (str): Key Manager authentication token.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3DLPViolationStreamResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + end_time, + next, + limit, + key_manager_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if start_time is not None: + + _query_params.append(('startTime', start_time)) + + if end_time is not None: + + _query_params.append(('endTime', end_time)) + + if next is not None: + + _query_params.append(('next', next)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if key_manager_token is not None: + _header_params['keyManagerToken'] = key_manager_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/dlp/violations/stream', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['start_time'] = \ - start_time - kwargs['session_token'] = \ - session_token - return self.v3_dlp_violations_stream_get_endpoint.call_with_http_info(**kwargs) + diff --git a/symphony/bdk/gen/agent_model/__init__.py b/symphony/bdk/gen/agent_model/__init__.py deleted file mode 100644 index a14105e9..00000000 --- a/symphony/bdk/gen/agent_model/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# do not import all models into this module because that uses a lot of memory and stack frames diff --git a/symphony/bdk/gen/agent_model/ack_id.py b/symphony/bdk/gen/agent_model/ack_id.py index 0951cf57..bee81dcd 100644 --- a/symphony/bdk/gen/agent_model/ack_id.py +++ b/symphony/bdk/gen/agent_model/ack_id.py @@ -1,261 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AckId(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'ack_id': (str, none_type), # noqa: E501 - 'update_presence': (bool, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class AckId(BaseModel): + """ + An object containing the ackId (and parameters) associated with events that the client has received through an individual feed. + """ # noqa: E501 + ack_id: Optional[StrictStr] = Field(default=None, description="A unique id for events that can be deleted from a client's. Parameter must be omitted or set to empty string for the first read. For successive reads, must be set to the ackId received in the last Datafeed Read. ", alias="ackId") + update_presence: Optional[StrictBool] = Field(default=True, description="Set to false to avoid updating the user's presence when reading events. Default is true.", alias="updatePresence") + __properties: ClassVar[List[str]] = ["ackId", "updatePresence"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'ack_id': 'ackId', # noqa: E501 - 'update_presence': 'updatePresence', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AckId - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - ack_id (str): A unique id for events that can be deleted from a client's. Empty for the first read. If set to null or missing, it will be considered empty feed. . [optional] # noqa: E501 - update_presence (bool): Set to false to avoid updating the user's presence when reading events. Default is true.. [optional] if omitted the server will use the default value of True # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AckId from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AckId - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - ack_id (str): A unique id for events that can be deleted from a client's. Empty for the first read. If set to null or missing, it will be considered empty feed. . [optional] # noqa: E501 - update_presence (bool): Set to false to avoid updating the user's presence when reading events. Default is true.. [optional] if omitted the server will use the default value of True # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AckId from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "ackId": obj.get("ackId"), + "updatePresence": obj.get("updatePresence") if obj.get("updatePresence") is not None else True + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.ack_id: str = None - self.update_presence: bool = True - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/agent_info.py b/symphony/bdk/gen/agent_model/agent_info.py index d90a5c62..8de0f9c3 100644 --- a/symphony/bdk/gen/agent_model/agent_info.py +++ b/symphony/bdk/gen/agent_model/agent_info.py @@ -1,291 +1,101 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AgentInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'ip_address': (str, none_type), # noqa: E501 - 'hostname': (str, none_type), # noqa: E501 - 'server_fqdn': (str, none_type), # noqa: E501 - 'version': (str, none_type), # noqa: E501 - 'url': (str, none_type), # noqa: E501 - 'on_prem': (bool, none_type), # noqa: E501 - 'mt': (bool, none_type), # noqa: E501 - 'commit_id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'ip_address': 'ipAddress', # noqa: E501 - 'hostname': 'hostname', # noqa: E501 - 'server_fqdn': 'serverFqdn', # noqa: E501 - 'version': 'version', # noqa: E501 - 'url': 'url', # noqa: E501 - 'on_prem': 'onPrem', # noqa: E501 - 'mt': 'mt', # noqa: E501 - 'commit_id': 'commitId', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class AgentInfo(BaseModel): + """ + AgentInfo + """ # noqa: E501 + ip_address: Optional[StrictStr] = Field(default=None, description="The IP address of the Agent server.", alias="ipAddress") + hostname: Optional[StrictStr] = Field(default=None, description="The hostname of the Agent server.") + server_fqdn: Optional[StrictStr] = Field(default=None, description="The fully-qualified domain name of the Agent server. Must be set by the user at startup.", alias="serverFqdn") + version: Optional[StrictStr] = Field(default=None, description="The version of the Agent.") + url: Optional[StrictStr] = Field(default=None, description="The URL under which the Agent is available.") + on_prem: Optional[StrictBool] = Field(default=None, description="Whether this is an on-prem or cloud installation.", alias="onPrem") + mt: Optional[StrictBool] = Field(default=None, description="Whether this is a multi tenant instance.") + commit_id: Optional[StrictStr] = Field(default=None, description="The Git commit ID of the running revision.", alias="commitId") + __properties: ClassVar[List[str]] = ["ipAddress", "hostname", "serverFqdn", "version", "url", "onPrem", "mt", "commitId"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AgentInfo - a agent_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AgentInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - ip_address (str): The IP address of the Agent server.. [optional] # noqa: E501 - hostname (str): The hostname of the Agent server.. [optional] # noqa: E501 - server_fqdn (str): The fully-qualified domain name of the Agent server. Must be set by the user at startup.. [optional] # noqa: E501 - version (str): The version of the Agent.. [optional] # noqa: E501 - url (str): The URL under which the Agent is available.. [optional] # noqa: E501 - on_prem (bool): Whether this is an on-prem or cloud installation.. [optional] # noqa: E501 - mt (bool): Whether this is a multi tenant instance.. [optional] # noqa: E501 - commit_id (str): The Git commit ID of the running revision.. [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AgentInfo - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - ip_address (str): The IP address of the Agent server.. [optional] # noqa: E501 - hostname (str): The hostname of the Agent server.. [optional] # noqa: E501 - server_fqdn (str): The fully-qualified domain name of the Agent server. Must be set by the user at startup.. [optional] # noqa: E501 - version (str): The version of the Agent.. [optional] # noqa: E501 - url (str): The URL under which the Agent is available.. [optional] # noqa: E501 - on_prem (bool): Whether this is an on-prem or cloud installation.. [optional] # noqa: E501 - mt (bool): Whether this is a multi tenant instance.. [optional] # noqa: E501 - commit_id (str): The Git commit ID of the running revision.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AgentInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ipAddress": obj.get("ipAddress"), + "hostname": obj.get("hostname"), + "serverFqdn": obj.get("serverFqdn"), + "version": obj.get("version"), + "url": obj.get("url"), + "onPrem": obj.get("onPrem"), + "mt": obj.get("mt"), + "commitId": obj.get("commitId") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.ip_address: str = None - self.hostname: str = None - self.server_fqdn: str = None - self.version: str = None - self.url: str = None - self.on_prem: bool = None - self.mt: bool = None - self.commit_id: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/attachment_info.py b/symphony/bdk/gen/agent_model/attachment_info.py index def65366..51ff675d 100644 --- a/symphony/bdk/gen/agent_model/attachment_info.py +++ b/symphony/bdk/gen/agent_model/attachment_info.py @@ -1,273 +1,91 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AttachmentInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str,), # noqa: E501 - 'name': (str,), # noqa: E501 - 'size': (int,), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class AttachmentInfo(BaseModel): + """ + AttachmentInfo + """ # noqa: E501 + id: StrictStr = Field(description="The attachment ID.") + name: StrictStr = Field(description="The file name.") + size: StrictInt = Field(description="Size in bytes.") + __properties: ClassVar[List[str]] = ["id", "name", "size"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - 'size': 'size', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, id, name, size, *args, **kwargs): # noqa: E501 - """AttachmentInfo - a agent_model defined in OpenAPI - - Args: - id (str): The attachment ID. - name (str): The file name. - size (int): Size in bytes. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AttachmentInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.id = id - self.name = name - self.size = size - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, id, name, size, *args, **kwargs): # noqa: E501 - """AttachmentInfo - a agent_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - id (str): The attachment ID. - name (str): The file name. - size (int): Size in bytes. + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AttachmentInfo from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "size": obj.get("size") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = id - self.name: str = name - self.size: int = size - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/base_message.py b/symphony/bdk/gen/agent_model/base_message.py index 7fbd8326..aa46de61 100644 --- a/symphony/bdk/gen/agent_model/base_message.py +++ b/symphony/bdk/gen/agent_model/base_message.py @@ -1,284 +1,110 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -class BaseMessage(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from importlib import import_module +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self - Do not edit the class manually. +from typing import TYPE_CHECKING +if TYPE_CHECKING: + from symphony.bdk.gen.agent_model.message import Message - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class BaseMessage(BaseModel): """ - - allowed_values = { + BaseMessage + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The messageId is assigned by the ingestor service when a message is sent.") + timestamp: StrictStr + message_type: StrictStr = Field(alias="messageType") + stream_id: StrictStr = Field(alias="streamId") + __properties: ClassVar[List[str]] = ["id", "timestamp", "messageType", "streamId"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + # JSON field name that stores the object type + __discriminator_property_name: ClassVar[str] = 'messageType' + + # discriminator mappings + __discriminator_value_class_map: ClassVar[Dict[str, str]] = { + 'Message': 'Message' } - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'timestamp': (str,), # noqa: E501 - 'message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - from symphony.bdk.gen.agent_model.message import Message - globals()['Message'] = Message - val = { - 'Message': Message, - } - if not val: + @classmethod + def get_discriminator_value(cls, obj: Dict[str, Any]) -> Optional[str]: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: return None - return {'message_type': val} - - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - 'message_type': 'messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'id': 'id', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, timestamp, message_type, stream_id, *args, **kwargs): # noqa: E501 - """BaseMessage - a agent_model defined in OpenAPI - - Args: - timestamp (str): - message_type (str): - stream_id (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Union[Message]]: + """Create an instance of BaseMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.timestamp = timestamp - self.message_type = message_type - self.stream_id = stream_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, timestamp, message_type, stream_id, *args, **kwargs): # noqa: E501 - """BaseMessage - a agent_model defined in OpenAPI - - Args: - timestamp (str): - message_type (str): - stream_id (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Optional[Union[Message]]: + """Create an instance of BaseMessage from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type == 'Message': + return import_module("symphony.bdk.gen.agent_model.message").Message.from_dict(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + raise ValueError("BaseMessage failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.timestamp: str = timestamp - self.message_type: str = message_type - self.stream_id: str = stream_id - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/base_signal.py b/symphony/bdk/gen/agent_model/base_signal.py index d0fcdc21..301bce1b 100644 --- a/symphony/bdk/gen/agent_model/base_signal.py +++ b/symphony/bdk/gen/agent_model/base_signal.py @@ -1,271 +1,93 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class BaseSignal(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class BaseSignal(BaseModel): """ + BaseSignal + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Signal name") + query: Optional[StrictStr] = Field(default=None, description="The query used to define this signal. The query is defined as \"field:value\" pairs combined by the operators \"AND\" or \"OR\". Supported fields are (case-insensitive): \"author\", \"hashtag\" and \"cashtag\". MUST contain at least one \"hashtag\" or \"cashtag\" definition. ") + visible_on_profile: Optional[StrictBool] = Field(default=None, description="Whether the signal is visible on its creator's profile", alias="visibleOnProfile") + company_wide: Optional[StrictBool] = Field(default=None, description="Whether the signal is a push signal", alias="companyWide") + __properties: ClassVar[List[str]] = ["name", "query", "visibleOnProfile", "companyWide"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BaseSignal from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'name': (str, none_type), # noqa: E501 - 'query': (str, none_type), # noqa: E501 - 'visible_on_profile': (bool, none_type), # noqa: E501 - 'company_wide': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'name': 'name', # noqa: E501 - 'query': 'query', # noqa: E501 - 'visible_on_profile': 'visibleOnProfile', # noqa: E501 - 'company_wide': 'companyWide', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """BaseSignal - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Signal name. [optional] # noqa: E501 - query (str): The query used to define this signal. The query is defined as \"field:value\" pairs combined by the operators \"AND\" or \"OR\". Supported fields are (case-insensitive): \"author\", \"hashtag\" and \"cashtag\". MUST contain at least one \"hashtag\" or \"cashtag\" definition. . [optional] # noqa: E501 - visible_on_profile (bool): Whether the signal is visible on its creator's profile. [optional] # noqa: E501 - company_wide (bool): Whether the signal is a push signal. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """BaseSignal - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Signal name. [optional] # noqa: E501 - query (str): The query used to define this signal. The query is defined as \"field:value\" pairs combined by the operators \"AND\" or \"OR\". Supported fields are (case-insensitive): \"author\", \"hashtag\" and \"cashtag\". MUST contain at least one \"hashtag\" or \"cashtag\" definition. . [optional] # noqa: E501 - visible_on_profile (bool): Whether the signal is visible on its creator's profile. [optional] # noqa: E501 - company_wide (bool): Whether the signal is a push signal. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BaseSignal from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "query": obj.get("query"), + "visibleOnProfile": obj.get("visibleOnProfile"), + "companyWide": obj.get("companyWide") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.query: str = None - self.visible_on_profile: bool = None - self.company_wide: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/channel_subscriber.py b/symphony/bdk/gen/agent_model/channel_subscriber.py index 5eb8ab4b..622afcfd 100644 --- a/symphony/bdk/gen/agent_model/channel_subscriber.py +++ b/symphony/bdk/gen/agent_model/channel_subscriber.py @@ -1,281 +1,97 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class ChannelSubscriber(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ChannelSubscriber(BaseModel): """ + ChannelSubscriber + """ # noqa: E501 + subscription_id: Optional[StrictStr] = Field(default=None, alias="subscriptionId") + pushed: Optional[StrictBool] = Field(default=False, description="True if the subscriber is allowed to unsubscribe") + owner: Optional[StrictBool] = Field(default=False, description="True if the subscriber is the creator") + subscriber_name: Optional[StrictStr] = Field(default=None, description="User display name", alias="subscriberName") + user_id: Optional[StrictInt] = Field(default=None, description="The user ID of the subscriber", alias="userId") + timestamp: Optional[StrictInt] = Field(default=None, description="Timestamp when the signal was subscribed, in milliseconds since Jan 1 1970") + __properties: ClassVar[List[str]] = ["subscriptionId", "pushed", "owner", "subscriberName", "userId", "timestamp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ChannelSubscriber from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'subscription_id': (str, none_type), # noqa: E501 - 'pushed': (bool, none_type), # noqa: E501 - 'owner': (bool, none_type), # noqa: E501 - 'subscriber_name': (str, none_type), # noqa: E501 - 'user_id': (int, none_type), # noqa: E501 - 'timestamp': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'subscription_id': 'subscriptionId', # noqa: E501 - 'pushed': 'pushed', # noqa: E501 - 'owner': 'owner', # noqa: E501 - 'subscriber_name': 'subscriberName', # noqa: E501 - 'user_id': 'userId', # noqa: E501 - 'timestamp': 'timestamp', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ChannelSubscriber - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - subscription_id (str): [optional] # noqa: E501 - pushed (bool): True if the subscriber is allowed to unsubscribe. [optional] if omitted the server will use the default value of False # noqa: E501 - owner (bool): True if the subscriber is the creator. [optional] if omitted the server will use the default value of False # noqa: E501 - subscriber_name (str): User display name. [optional] # noqa: E501 - user_id (int): The user ID of the subscriber. [optional] # noqa: E501 - timestamp (int): Timestamp when the signal was subscribed, in milliseconds since Jan 1 1970. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ChannelSubscriber - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - subscription_id (str): [optional] # noqa: E501 - pushed (bool): True if the subscriber is allowed to unsubscribe. [optional] if omitted the server will use the default value of False # noqa: E501 - owner (bool): True if the subscriber is the creator. [optional] if omitted the server will use the default value of False # noqa: E501 - subscriber_name (str): User display name. [optional] # noqa: E501 - user_id (int): The user ID of the subscriber. [optional] # noqa: E501 - timestamp (int): Timestamp when the signal was subscribed, in milliseconds since Jan 1 1970. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ChannelSubscriber from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "subscriptionId": obj.get("subscriptionId"), + "pushed": obj.get("pushed") if obj.get("pushed") is not None else False, + "owner": obj.get("owner") if obj.get("owner") is not None else False, + "subscriberName": obj.get("subscriberName"), + "userId": obj.get("userId"), + "timestamp": obj.get("timestamp") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.subscription_id: str = None - self.pushed: bool = False - self.owner: bool = False - self.subscriber_name: str = None - self.user_id: int = None - self.timestamp: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/channel_subscriber_response.py b/symphony/bdk/gen/agent_model/channel_subscriber_response.py index 112dfe7b..85bc50bf 100644 --- a/symphony/bdk/gen/agent_model/channel_subscriber_response.py +++ b/symphony/bdk/gen/agent_model/channel_subscriber_response.py @@ -1,274 +1,101 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.channel_subscriber import ChannelSubscriber -globals()['ChannelSubscriber'] = ChannelSubscriber - -class ChannelSubscriberResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ChannelSubscriberResponse(BaseModel): """ + ChannelSubscriberResponse + """ # noqa: E501 + offset: Optional[StrictInt] = Field(default=None, description="The number of subscribers skipped") + has_more: Optional[StrictBool] = Field(default=None, description="True if there are more subscribers", alias="hasMore") + total: Optional[StrictInt] = Field(default=None, description="The total number of subscribers") + data: Optional[List[ChannelSubscriber]] = None + __properties: ClassVar[List[str]] = ["offset", "hasMore", "total", "data"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ChannelSubscriberResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'offset': (int, none_type), # noqa: E501 - 'has_more': (bool, none_type), # noqa: E501 - 'total': (int, none_type), # noqa: E501 - 'data': ([ChannelSubscriber], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'offset': 'offset', # noqa: E501 - 'has_more': 'hasMore', # noqa: E501 - 'total': 'total', # noqa: E501 - 'data': 'data', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ChannelSubscriberResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - offset (int): The number of subscribers skipped. [optional] # noqa: E501 - has_more (bool): True if there are more subscribers. [optional] # noqa: E501 - total (int): The total number of subscribers. [optional] # noqa: E501 - data ([ChannelSubscriber]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ChannelSubscriberResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - offset (int): The number of subscribers skipped. [optional] # noqa: E501 - has_more (bool): True if there are more subscribers. [optional] # noqa: E501 - total (int): The total number of subscribers. [optional] # noqa: E501 - data ([ChannelSubscriber]): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ChannelSubscriberResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "offset": obj.get("offset"), + "hasMore": obj.get("hasMore"), + "total": obj.get("total"), + "data": [ChannelSubscriber.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.offset: int = None - self.has_more: bool = None - self.total: int = None - self.data: List[ChannelSubscriber] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/channel_subscription_error.py b/symphony/bdk/gen/agent_model/channel_subscription_error.py index cefb73cd..5788528a 100644 --- a/symphony/bdk/gen/agent_model/channel_subscription_error.py +++ b/symphony/bdk/gen/agent_model/channel_subscription_error.py @@ -1,266 +1,91 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class ChannelSubscriptionError(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_id': (int, none_type), # noqa: E501 - 'code': (str, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class ChannelSubscriptionError(BaseModel): + """ + ChannelSubscriptionError + """ # noqa: E501 + user_id: Optional[StrictInt] = Field(default=None, description="The userId on which failure happened", alias="userId") + code: Optional[StrictStr] = Field(default=None, description="subscription failure code") + message: Optional[StrictStr] = Field(default=None, description="subscription failure message") + __properties: ClassVar[List[str]] = ["userId", "code", "message"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'user_id': 'userId', # noqa: E501 - 'code': 'code', # noqa: E501 - 'message': 'message', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ChannelSubscriptionError - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): The userId on which failure happened. [optional] # noqa: E501 - code (str): subscription failure code. [optional] # noqa: E501 - message (str): subscription failure message. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ChannelSubscriptionError from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ChannelSubscriptionError - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): The userId on which failure happened. [optional] # noqa: E501 - code (str): subscription failure code. [optional] # noqa: E501 - message (str): subscription failure message. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ChannelSubscriptionError from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "userId": obj.get("userId"), + "code": obj.get("code"), + "message": obj.get("message") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_id: int = None - self.code: str = None - self.message: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/channel_subscription_response.py b/symphony/bdk/gen/agent_model/channel_subscription_response.py index d3c8a623..5905b1cc 100644 --- a/symphony/bdk/gen/agent_model/channel_subscription_response.py +++ b/symphony/bdk/gen/agent_model/channel_subscription_response.py @@ -1,274 +1,101 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.channel_subscription_error import ChannelSubscriptionError -globals()['ChannelSubscriptionError'] = ChannelSubscriptionError - -class ChannelSubscriptionResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ChannelSubscriptionResponse(BaseModel): """ + ChannelSubscriptionResponse + """ # noqa: E501 + requested_subscription: Optional[StrictInt] = Field(default=None, description="The number of requested userIds to subscribe", alias="requestedSubscription") + successful_subscription: Optional[StrictInt] = Field(default=None, description="The number of successful subscriptions done", alias="successfulSubscription") + failed_subscription: Optional[StrictInt] = Field(default=None, description="The number of subscription failures", alias="failedSubscription") + subscription_errors: Optional[List[ChannelSubscriptionError]] = Field(default=None, alias="subscriptionErrors") + __properties: ClassVar[List[str]] = ["requestedSubscription", "successfulSubscription", "failedSubscription", "subscriptionErrors"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ChannelSubscriptionResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'requested_subscription': (int, none_type), # noqa: E501 - 'successful_subscription': (int, none_type), # noqa: E501 - 'failed_subscription': (int, none_type), # noqa: E501 - 'subscription_errors': ([ChannelSubscriptionError], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'requested_subscription': 'requestedSubscription', # noqa: E501 - 'successful_subscription': 'successfulSubscription', # noqa: E501 - 'failed_subscription': 'failedSubscription', # noqa: E501 - 'subscription_errors': 'subscriptionErrors', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in subscription_errors (list) + _items = [] + if self.subscription_errors: + for _item_subscription_errors in self.subscription_errors: + if _item_subscription_errors: + _items.append(_item_subscription_errors.to_dict()) + _dict['subscriptionErrors'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ChannelSubscriptionResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - requested_subscription (int): The number of requested userIds to subscribe. [optional] # noqa: E501 - successful_subscription (int): The number of successful subscriptions done. [optional] # noqa: E501 - failed_subscription (int): The number of subscription failures. [optional] # noqa: E501 - subscription_errors ([ChannelSubscriptionError]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ChannelSubscriptionResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - requested_subscription (int): The number of requested userIds to subscribe. [optional] # noqa: E501 - successful_subscription (int): The number of successful subscriptions done. [optional] # noqa: E501 - failed_subscription (int): The number of subscription failures. [optional] # noqa: E501 - subscription_errors ([ChannelSubscriptionError]): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ChannelSubscriptionResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "requestedSubscription": obj.get("requestedSubscription"), + "successfulSubscription": obj.get("successfulSubscription"), + "failedSubscription": obj.get("failedSubscription"), + "subscriptionErrors": [ChannelSubscriptionError.from_dict(_item) for _item in obj["subscriptionErrors"]] if obj.get("subscriptionErrors") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.requested_subscription: int = None - self.successful_subscription: int = None - self.failed_subscription: int = None - self.subscription_errors: List[ChannelSubscriptionError] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/connection_request_message.py b/symphony/bdk/gen/agent_model/connection_request_message.py index 410473de..5a7bc9af 100644 --- a/symphony/bdk/gen/agent_model/connection_request_message.py +++ b/symphony/bdk/gen/agent_model/connection_request_message.py @@ -1,358 +1,102 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.agent_model.connection_request_message_all_of import ConnectionRequestMessageAllOf +from pydantic import ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage -globals()['ConnectionRequestMessageAllOf'] = ConnectionRequestMessageAllOf -globals()['V2BaseMessage'] = V2BaseMessage - -class ConnectionRequestMessage(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ConnectionRequestMessage(V2BaseMessage): """ + Generated when a connection request is sent. + """ # noqa: E501 + requesting_user_id: Optional[StrictInt] = Field(default=None, alias="requestingUserId") + target_user_id: Optional[StrictInt] = Field(default=None, alias="targetUserId") + first_requested_at: Optional[StrictInt] = Field(default=None, alias="firstRequestedAt") + updated_at: Optional[StrictInt] = Field(default=None, alias="updatedAt") + request_counter: Optional[StrictInt] = Field(default=None, alias="requestCounter") + status: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "timestamp", "v2messageType", "streamId", "requestingUserId", "targetUserId", "firstRequestedAt", "updatedAt", "requestCounter", "status"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConnectionRequestMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'timestamp': (str,), # noqa: E501 - 'v2message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'requesting_user_id': (int, none_type), # noqa: E501 - 'target_user_id': (int, none_type), # noqa: E501 - 'first_requested_at': (int, none_type), # noqa: E501 - 'updated_at': (int, none_type), # noqa: E501 - 'request_counter': (int, none_type), # noqa: E501 - 'status': (str, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - val = { - } - if not val: - return None - return {'v2message_type': val} + excluded_fields: Set[str] = set([ + ]) - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - 'v2message_type': 'v2messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'requesting_user_id': 'requestingUserId', # noqa: E501 - 'target_user_id': 'targetUserId', # noqa: E501 - 'first_requested_at': 'firstRequestedAt', # noqa: E501 - 'updated_at': 'updatedAt', # noqa: E501 - 'request_counter': 'requestCounter', # noqa: E501 - 'status': 'status', # noqa: E501 - 'id': 'id', # noqa: E501 - } - - read_only_vars = { - } + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ConnectionRequestMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - requesting_user_id (int): [optional] # noqa: E501 - target_user_id (int): [optional] # noqa: E501 - first_requested_at (int): [optional] # noqa: E501 - updated_at (int): [optional] # noqa: E501 - request_counter (int): [optional] # noqa: E501 - status (str): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ConnectionRequestMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - requesting_user_id (int): [optional] # noqa: E501 - target_user_id (int): [optional] # noqa: E501 - first_requested_at (int): [optional] # noqa: E501 - updated_at (int): [optional] # noqa: E501 - request_counter (int): [optional] # noqa: E501 - status (str): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConnectionRequestMessage from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "id": obj.get("id"), + "timestamp": obj.get("timestamp"), + "v2messageType": obj.get("v2messageType"), + "streamId": obj.get("streamId"), + "requestingUserId": obj.get("requestingUserId"), + "targetUserId": obj.get("targetUserId"), + "firstRequestedAt": obj.get("firstRequestedAt"), + "updatedAt": obj.get("updatedAt"), + "requestCounter": obj.get("requestCounter"), + "status": obj.get("status") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.timestamp: str = kwargs['timestamp'] - self.v2message_type: str = kwargs['v2message_type'] - self.stream_id: str = kwargs['stream_id'] - self.requesting_user_id: int = None - self.target_user_id: int = None - self.first_requested_at: int = None - self.updated_at: int = None - self.request_counter: int = None - self.status: str = None - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - ConnectionRequestMessageAllOf, - V2BaseMessage, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/connection_request_message_all_of.py b/symphony/bdk/gen/agent_model/connection_request_message_all_of.py deleted file mode 100644 index c7697813..00000000 --- a/symphony/bdk/gen/agent_model/connection_request_message_all_of.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class ConnectionRequestMessageAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'requesting_user_id': (int, none_type), # noqa: E501 - 'target_user_id': (int, none_type), # noqa: E501 - 'first_requested_at': (int, none_type), # noqa: E501 - 'updated_at': (int, none_type), # noqa: E501 - 'request_counter': (int, none_type), # noqa: E501 - 'status': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'requesting_user_id': 'requestingUserId', # noqa: E501 - 'target_user_id': 'targetUserId', # noqa: E501 - 'first_requested_at': 'firstRequestedAt', # noqa: E501 - 'updated_at': 'updatedAt', # noqa: E501 - 'request_counter': 'requestCounter', # noqa: E501 - 'status': 'status', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ConnectionRequestMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - requesting_user_id (int): [optional] # noqa: E501 - target_user_id (int): [optional] # noqa: E501 - first_requested_at (int): [optional] # noqa: E501 - updated_at (int): [optional] # noqa: E501 - request_counter (int): [optional] # noqa: E501 - status (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ConnectionRequestMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - requesting_user_id (int): [optional] # noqa: E501 - target_user_id (int): [optional] # noqa: E501 - first_requested_at (int): [optional] # noqa: E501 - updated_at (int): [optional] # noqa: E501 - request_counter (int): [optional] # noqa: E501 - status (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.requesting_user_id: int = None - self.target_user_id: int = None - self.first_requested_at: int = None - self.updated_at: int = None - self.request_counter: int = None - self.status: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/datafeed.py b/symphony/bdk/gen/agent_model/datafeed.py index ccc0fa3e..12c8ca90 100644 --- a/symphony/bdk/gen/agent_model/datafeed.py +++ b/symphony/bdk/gen/agent_model/datafeed.py @@ -1,256 +1,87 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Datafeed(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Datafeed(BaseModel): + """ + Datafeed + """ # noqa: E501 + id: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Datafeed - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Datafeed from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Datafeed - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Datafeed from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/error.py b/symphony/bdk/gen/agent_model/error.py index 8458f8e2..24a293ff 100644 --- a/symphony/bdk/gen/agent_model/error.py +++ b/symphony/bdk/gen/agent_model/error.py @@ -1,261 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Error(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'code': (int, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Error(BaseModel): + """ + Error + """ # noqa: E501 + code: Optional[StrictInt] = None + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["code", "message"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'code': 'code', # noqa: E501 - 'message': 'message', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Error - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - code (int): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Error from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Error - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - code (int): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Error from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.code: int = None - self.message: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/import_response.py b/symphony/bdk/gen/agent_model/import_response.py index 6e11c179..de06e813 100644 --- a/symphony/bdk/gen/agent_model/import_response.py +++ b/symphony/bdk/gen/agent_model/import_response.py @@ -1,261 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class ImportResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message_id': (str, none_type), # noqa: E501 - 'diagnostic': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class ImportResponse(BaseModel): + """ + ImportResponse + """ # noqa: E501 + message_id: Optional[StrictStr] = Field(default=None, description="If the message was successfully imported then the message ID in the system of the newly created message. ", alias="messageId") + diagnostic: Optional[StrictStr] = Field(default=None, description="A diagnostic message containing an error message in the event that the message import failed. May also be present in the case of a successful call if there is useful narrative to return. ") + __properties: ClassVar[List[str]] = ["messageId", "diagnostic"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'message_id': 'messageId', # noqa: E501 - 'diagnostic': 'diagnostic', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ImportResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): If the message was successfully imported then the message ID in the system of the newly created message. . [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the message import failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ImportResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ImportResponse - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): If the message was successfully imported then the message ID in the system of the newly created message. . [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the message import failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ImportResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "messageId": obj.get("messageId"), + "diagnostic": obj.get("diagnostic") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message_id: str = None - self.diagnostic: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/import_response_list.py b/symphony/bdk/gen/agent_model/import_response_list.py deleted file mode 100644 index 4dc56e88..00000000 --- a/symphony/bdk/gen/agent_model/import_response_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.import_response import ImportResponse -globals()['ImportResponse'] = ImportResponse - -class ImportResponseList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([ImportResponse],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """ImportResponseList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([ImportResponse]): # noqa: E501 - - Keyword Args: - value ([ImportResponse]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[ImportResponse] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """ImportResponseList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([ImportResponse]): # noqa: E501 - - Keyword Args: - value ([ImportResponse]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/imported_message.py b/symphony/bdk/gen/agent_model/imported_message.py index 2f049423..25be6c8a 100644 --- a/symphony/bdk/gen/agent_model/imported_message.py +++ b/symphony/bdk/gen/agent_model/imported_message.py @@ -1,294 +1,107 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class ImportedMessage(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ImportedMessage(BaseModel): """ + A historic message to be imported into the system. The importing user must have the Content Management role. Also, the importing user must be a member of the conversation it is importing into. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. By design, imported messages do not stream to datafeed or firehose endpoints. + """ # noqa: E501 + message: StrictStr = Field(description="Message text in MessageML") + format: Optional[StrictStr] = None + intended_message_timestamp: StrictInt = Field(description="The timestamp representing the time when the message was sent in the original system in milliseconds since Jan 1st 1970. ", alias="intendedMessageTimestamp") + intended_message_from_user_id: StrictInt = Field(description="The long integer userid of the Symphony user who you intend to show sent the message.", alias="intendedMessageFromUserId") + originating_system_id: StrictStr = Field(description="The ID of the system through which the message was originally sent.", alias="originatingSystemId") + stream_id: StrictStr = Field(alias="streamId") + __properties: ClassVar[List[str]] = ["message", "format", "intendedMessageTimestamp", "intendedMessageFromUserId", "originatingSystemId", "streamId"] + + @field_validator('format') + def format_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['TEXT', 'MESSAGEML']): + raise ValueError("must be one of enum values ('TEXT', 'MESSAGEML')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('format',): { - 'TEXT': "TEXT", - 'MESSAGEML': "MESSAGEML", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ImportedMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'message': (str,), # noqa: E501 - 'intended_message_timestamp': (int,), # noqa: E501 - 'intended_message_from_user_id': (int,), # noqa: E501 - 'originating_system_id': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'format': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - + excluded_fields: Set[str] = set([ + ]) - attribute_map = { - 'message': 'message', # noqa: E501 - 'intended_message_timestamp': 'intendedMessageTimestamp', # noqa: E501 - 'intended_message_from_user_id': 'intendedMessageFromUserId', # noqa: E501 - 'originating_system_id': 'originatingSystemId', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'format': 'format', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, message, intended_message_timestamp, intended_message_from_user_id, originating_system_id, stream_id, *args, **kwargs): # noqa: E501 - """ImportedMessage - a agent_model defined in OpenAPI - - Args: - message (str): Message text in MessageML - intended_message_timestamp (int): The timestamp representing the time when the message was sent in the original system in milliseconds since Jan 1st 1970. - intended_message_from_user_id (int): The long integer userid of the Symphony user who you intend to show sent the message. - originating_system_id (str): The ID of the system through which the message was originally sent. - stream_id (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.message = message - self.intended_message_timestamp = intended_message_timestamp - self.intended_message_from_user_id = intended_message_from_user_id - self.originating_system_id = originating_system_id - self.stream_id = stream_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, message, intended_message_timestamp, intended_message_from_user_id, originating_system_id, stream_id, *args, **kwargs): # noqa: E501 - """ImportedMessage - a agent_model defined in OpenAPI - - Args: - message (str): Message text in MessageML - intended_message_timestamp (int): The timestamp representing the time when the message was sent in the original system in milliseconds since Jan 1st 1970. - intended_message_from_user_id (int): The long integer userid of the Symphony user who you intend to show sent the message. - originating_system_id (str): The ID of the system through which the message was originally sent. - stream_id (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ImportedMessage from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "message": obj.get("message"), + "format": obj.get("format"), + "intendedMessageTimestamp": obj.get("intendedMessageTimestamp"), + "intendedMessageFromUserId": obj.get("intendedMessageFromUserId"), + "originatingSystemId": obj.get("originatingSystemId"), + "streamId": obj.get("streamId") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message: str = message - self.intended_message_timestamp: int = intended_message_timestamp - self.intended_message_from_user_id: int = intended_message_from_user_id - self.originating_system_id: str = originating_system_id - self.stream_id: str = stream_id - self.format: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/ingestion_error.py b/symphony/bdk/gen/agent_model/ingestion_error.py index f06ca589..10c27098 100644 --- a/symphony/bdk/gen/agent_model/ingestion_error.py +++ b/symphony/bdk/gen/agent_model/ingestion_error.py @@ -1,266 +1,91 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class IngestionError(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'code': (int, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - 'ingestion_status': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class IngestionError(BaseModel): + """ + IngestionError + """ # noqa: E501 + code: Optional[StrictInt] = None + message: Optional[StrictStr] = None + ingestion_status: Optional[StrictStr] = Field(default=None, alias="ingestionStatus") + __properties: ClassVar[List[str]] = ["code", "message", "ingestionStatus"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'code': 'code', # noqa: E501 - 'message': 'message', # noqa: E501 - 'ingestion_status': 'ingestionStatus', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """IngestionError - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - code (int): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - ingestion_status (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of IngestionError from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """IngestionError - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - code (int): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - ingestion_status (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of IngestionError from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "ingestionStatus": obj.get("ingestionStatus") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.code: int = None - self.message: str = None - self.ingestion_status: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/message.py b/symphony/bdk/gen/agent_model/message.py index 6cf9c97f..b054d17b 100644 --- a/symphony/bdk/gen/agent_model/message.py +++ b/symphony/bdk/gen/agent_model/message.py @@ -1,338 +1,94 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List from symphony.bdk.gen.agent_model.base_message import BaseMessage -from symphony.bdk.gen.agent_model.message_all_of import MessageAllOf -globals()['BaseMessage'] = BaseMessage -globals()['MessageAllOf'] = MessageAllOf - -class Message(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class Message(BaseMessage): """ + A representation of a message sent by a user of Symphony. + """ # noqa: E501 + message: StrictStr = Field(description="Message text in MessageML") + from_user_id: StrictInt = Field(description="the Symphony userId of the user who sent the message. This will be populated by the server (and actually ignored if included when sending a message).", alias="fromUserId") + __properties: ClassVar[List[str]] = ["id", "timestamp", "messageType", "streamId", "message", "fromUserId"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str,), # noqa: E501 - 'from_user_id': (int,), # noqa: E501 - 'timestamp': (str,), # noqa: E501 - 'message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - val = { - } - if not val: - return None - return {'message_type': val} - - attribute_map = { - 'message': 'message', # noqa: E501 - 'from_user_id': 'fromUserId', # noqa: E501 - 'timestamp': 'timestamp', # noqa: E501 - 'message_type': 'messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'id': 'id', # noqa: E501 - } - - read_only_vars = { - } + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Message - a agent_model defined in OpenAPI - - Keyword Args: - message (str): Message text in MessageML - from_user_id (int): the Symphony userId of the user who sent the message. This will be populated by the server (and actually ignored if included when sending a message). - timestamp (str): - message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Message from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Message - a agent_model defined in OpenAPI - - Keyword Args: - message (str): Message text in MessageML - from_user_id (int): the Symphony userId of the user who sent the message. This will be populated by the server (and actually ignored if included when sending a message). - timestamp (str): - message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Message from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "id": obj.get("id"), + "timestamp": obj.get("timestamp"), + "messageType": obj.get("messageType"), + "streamId": obj.get("streamId"), + "message": obj.get("message"), + "fromUserId": obj.get("fromUserId") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.message: str = kwargs['message'] - self.from_user_id: int = kwargs['from_user_id'] - self.timestamp: str = kwargs['timestamp'] - self.message_type: str = kwargs['message_type'] - self.stream_id: str = kwargs['stream_id'] - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - BaseMessage, - MessageAllOf, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/message_all_of.py b/symphony/bdk/gen/agent_model/message_all_of.py deleted file mode 100644 index 6e3ecd19..00000000 --- a/symphony/bdk/gen/agent_model/message_all_of.py +++ /dev/null @@ -1,267 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class MessageAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str,), # noqa: E501 - 'from_user_id': (int,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message': 'message', # noqa: E501 - 'from_user_id': 'fromUserId', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, message, from_user_id, *args, **kwargs): # noqa: E501 - """MessageAllOf - a agent_model defined in OpenAPI - - Args: - message (str): Message text in MessageML - from_user_id (int): the Symphony userId of the user who sent the message. This will be populated by the server (and actually ignored if included when sending a message). - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.message = message - self.from_user_id = from_user_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, message, from_user_id, *args, **kwargs): # noqa: E501 - """MessageAllOf - a agent_model defined in OpenAPI - - Args: - message (str): Message text in MessageML - from_user_id (int): the Symphony userId of the user who sent the message. This will be populated by the server (and actually ignored if included when sending a message). - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.message: str = message - self.from_user_id: int = from_user_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/message_import_list.py b/symphony/bdk/gen/agent_model/message_import_list.py deleted file mode 100644 index 476c8d46..00000000 --- a/symphony/bdk/gen/agent_model/message_import_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.imported_message import ImportedMessage -globals()['ImportedMessage'] = ImportedMessage - -class MessageImportList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([ImportedMessage],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """MessageImportList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([ImportedMessage]): An ordered list of historic messages to be imported. A list of import responsees will be returned in the same order. . # noqa: E501 - - Keyword Args: - value ([ImportedMessage]): An ordered list of historic messages to be imported. A list of import responsees will be returned in the same order. . # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[ImportedMessage] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """MessageImportList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([ImportedMessage]): An ordered list of historic messages to be imported. A list of import responsees will be returned in the same order. . # noqa: E501 - - Keyword Args: - value ([ImportedMessage]): An ordered list of historic messages to be imported. A list of import responsees will be returned in the same order. . # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/message_list.py b/symphony/bdk/gen/agent_model/message_list.py deleted file mode 100644 index a7d5d25f..00000000 --- a/symphony/bdk/gen/agent_model/message_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.message import Message -globals()['Message'] = Message - -class MessageList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([Message],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """MessageList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Message]): # noqa: E501 - - Keyword Args: - value ([Message]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[Message] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """MessageList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Message]): # noqa: E501 - - Keyword Args: - value ([Message]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/message_search_query.py b/symphony/bdk/gen/agent_model/message_search_query.py index ec47b4b5..491b80d5 100644 --- a/symphony/bdk/gen/agent_model/message_search_query.py +++ b/symphony/bdk/gen/agent_model/message_search_query.py @@ -1,301 +1,105 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class MessageSearchQuery(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'text': (str, none_type), # noqa: E501 - 'stream_id': (str, none_type), # noqa: E501 - 'stream_type': (str, none_type), # noqa: E501 - 'author': (int, none_type), # noqa: E501 - 'hashtag': (str, none_type), # noqa: E501 - 'cashtag': (str, none_type), # noqa: E501 - 'mention': (int, none_type), # noqa: E501 - 'signal': (str, none_type), # noqa: E501 - 'from_date': (int, none_type), # noqa: E501 - 'to_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'text': 'text', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'stream_type': 'streamType', # noqa: E501 - 'author': 'author', # noqa: E501 - 'hashtag': 'hashtag', # noqa: E501 - 'cashtag': 'cashtag', # noqa: E501 - 'mention': 'mention', # noqa: E501 - 'signal': 'signal', # noqa: E501 - 'from_date': 'fromDate', # noqa: E501 - 'to_date': 'toDate', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class MessageSearchQuery(BaseModel): + """ + MessageSearchQuery + """ # noqa: E501 + text: Optional[StrictStr] = Field(default=None, description="Search for messages containing this text. Requires streamId to be specified.") + stream_id: Optional[StrictStr] = Field(default=None, description="Search for messages sent to this stream", alias="streamId") + stream_type: Optional[StrictStr] = Field(default=None, description="Search for messages sent to this type of streams. Accepted values are CHAT, IM, MIM, ROOM, POST. ", alias="streamType") + author: Optional[StrictInt] = Field(default=None, description="Search for messages sent by this user ID") + hashtag: Optional[StrictStr] = Field(default=None, description="Search for messages containing this hashtag") + cashtag: Optional[StrictStr] = Field(default=None, description="Search for messages containing this cashtag") + mention: Optional[StrictInt] = Field(default=None, description="Search for messages mentioning this user ID") + signal: Optional[StrictStr] = Field(default=None, description="Search for messages matching this signal. Can only be combined with date filtering and paging parameters. ") + from_date: Optional[StrictInt] = Field(default=None, description="Search for messages sent on or after this timestamp", alias="fromDate") + to_date: Optional[StrictInt] = Field(default=None, description="Search for messages sent before this timestamp", alias="toDate") + __properties: ClassVar[List[str]] = ["text", "streamId", "streamType", "author", "hashtag", "cashtag", "mention", "signal", "fromDate", "toDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageSearchQuery - a agent_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageSearchQuery from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - text (str): Search for messages containing this text. Requires streamId to be specified.. [optional] # noqa: E501 - stream_id (str): Search for messages sent to this stream. [optional] # noqa: E501 - stream_type (str): Search for messages sent to this type of streams. Accepted values are CHAT, IM, MIM, ROOM, POST. . [optional] # noqa: E501 - author (int): Search for messages sent by this user ID. [optional] # noqa: E501 - hashtag (str): Search for messages containing this hashtag. [optional] # noqa: E501 - cashtag (str): Search for messages containing this cashtag. [optional] # noqa: E501 - mention (int): Search for messages mentioning this user ID. [optional] # noqa: E501 - signal (str): Search for messages matching this signal. Can only be combined with date filtering and paging parameters. . [optional] # noqa: E501 - from_date (int): Search for messages sent on or after this timestamp. [optional] # noqa: E501 - to_date (int): Search for messages sent before this timestamp. [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageSearchQuery - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - text (str): Search for messages containing this text. Requires streamId to be specified.. [optional] # noqa: E501 - stream_id (str): Search for messages sent to this stream. [optional] # noqa: E501 - stream_type (str): Search for messages sent to this type of streams. Accepted values are CHAT, IM, MIM, ROOM, POST. . [optional] # noqa: E501 - author (int): Search for messages sent by this user ID. [optional] # noqa: E501 - hashtag (str): Search for messages containing this hashtag. [optional] # noqa: E501 - cashtag (str): Search for messages containing this cashtag. [optional] # noqa: E501 - mention (int): Search for messages mentioning this user ID. [optional] # noqa: E501 - signal (str): Search for messages matching this signal. Can only be combined with date filtering and paging parameters. . [optional] # noqa: E501 - from_date (int): Search for messages sent on or after this timestamp. [optional] # noqa: E501 - to_date (int): Search for messages sent before this timestamp. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageSearchQuery from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "text": obj.get("text"), + "streamId": obj.get("streamId"), + "streamType": obj.get("streamType"), + "author": obj.get("author"), + "hashtag": obj.get("hashtag"), + "cashtag": obj.get("cashtag"), + "mention": obj.get("mention"), + "signal": obj.get("signal"), + "fromDate": obj.get("fromDate"), + "toDate": obj.get("toDate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.text: str = None - self.stream_id: str = None - self.stream_type: str = None - self.author: int = None - self.hashtag: str = None - self.cashtag: str = None - self.mention: int = None - self.signal: str = None - self.from_date: int = None - self.to_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/message_submission.py b/symphony/bdk/gen/agent_model/message_submission.py index 9c457a9f..82fa9e80 100644 --- a/symphony/bdk/gen/agent_model/message_submission.py +++ b/symphony/bdk/gen/agent_model/message_submission.py @@ -1,265 +1,99 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class MessageSubmission(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class MessageSubmission(BaseModel): """ + MessageSubmission + """ # noqa: E501 + format: Optional[StrictStr] = None + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["format", "message"] + + @field_validator('format') + def format_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['TEXT', 'MESSAGEML']): + raise ValueError("must be one of enum values ('TEXT', 'MESSAGEML')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('format',): { - 'TEXT': "TEXT", - 'MESSAGEML': "MESSAGEML", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageSubmission from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'format': (str, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'format': 'format', # noqa: E501 - 'message': 'message', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageSubmission - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageSubmission - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageSubmission from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "format": obj.get("format"), + "message": obj.get("message") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.format: str = None - self.message: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/pagination.py b/symphony/bdk/gen/agent_model/pagination.py index 10b2760b..037eb2a6 100644 --- a/symphony/bdk/gen/agent_model/pagination.py +++ b/symphony/bdk/gen/agent_model/pagination.py @@ -1,274 +1,95 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.pagination_cursors import PaginationCursors -globals()['PaginationCursors'] = PaginationCursors - -class Pagination(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class Pagination(BaseModel): """ + Pagination + """ # noqa: E501 + cursors: PaginationCursors + previous: Optional[StrictStr] = Field(default=None, description="API endpoint that will return the previous page of data. If not included, this is the first page of data. ") + next: Optional[StrictStr] = Field(default=None, description="API endpoint that will return the next page of data. If not included, this is the last page of data. Due to how pagination works with visibility and privacy, it is possible that a page may be empty but contain a 'next' paging link. Stop paging when the 'next' link no longer appears. ") + __properties: ClassVar[List[str]] = ["cursors", "previous", "next"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'cursors': (PaginationCursors,), # noqa: E501 - 'previous': (str, none_type), # noqa: E501 - 'next': (str, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'cursors': 'cursors', # noqa: E501 - 'previous': 'previous', # noqa: E501 - 'next': 'next', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, cursors, *args, **kwargs): # noqa: E501 - """Pagination - a agent_model defined in OpenAPI - - Args: - cursors (PaginationCursors): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - previous (str): API endpoint that will return the previous page of data. If not included, this is the first page of data. . [optional] # noqa: E501 - next (str): API endpoint that will return the next page of data. If not included, this is the last page of data. Due to how pagination works with visibility and privacy, it is possible that a page may be empty but contain a 'next' paging link. Stop paging when the 'next' link no longer appears. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Pagination from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.cursors = cursors - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, cursors, *args, **kwargs): # noqa: E501 - """Pagination - a agent_model defined in OpenAPI - - Args: - cursors (PaginationCursors): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - previous (str): API endpoint that will return the previous page of data. If not included, this is the first page of data. . [optional] # noqa: E501 - next (str): API endpoint that will return the next page of data. If not included, this is the last page of data. Due to how pagination works with visibility and privacy, it is possible that a page may be empty but contain a 'next' paging link. Stop paging when the 'next' link no longer appears. . [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of cursors + if self.cursors: + _dict['cursors'] = self.cursors.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Pagination from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "cursors": PaginationCursors.from_dict(obj["cursors"]) if obj.get("cursors") is not None else None, + "previous": obj.get("previous"), + "next": obj.get("next") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.cursors: PaginationCursors = cursors - self.previous: str = None - self.next: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/pagination_cursors.py b/symphony/bdk/gen/agent_model/pagination_cursors.py index 01386d38..32c92a10 100644 --- a/symphony/bdk/gen/agent_model/pagination_cursors.py +++ b/symphony/bdk/gen/agent_model/pagination_cursors.py @@ -1,261 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class PaginationCursors(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'before': (str, none_type), # noqa: E501 - 'after': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class PaginationCursors(BaseModel): + """ + PaginationCursors + """ # noqa: E501 + before: Optional[StrictStr] = Field(default=None, description="This is the opaque url-safe string that points to the start of the page of data that has been returned. ") + after: Optional[StrictStr] = Field(default=None, description="This is the opaque url-safe string that points to the end of the page of data that has been returned. ") + __properties: ClassVar[List[str]] = ["before", "after"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'before': 'before', # noqa: E501 - 'after': 'after', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """PaginationCursors - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - before (str): This is the opaque url-safe string that points to the start of the page of data that has been returned. . [optional] # noqa: E501 - after (str): This is the opaque url-safe string that points to the end of the page of data that has been returned. . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PaginationCursors from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """PaginationCursors - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - before (str): This is the opaque url-safe string that points to the start of the page of data that has been returned. . [optional] # noqa: E501 - after (str): This is the opaque url-safe string that points to the end of the page of data that has been returned. . [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaginationCursors from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "before": obj.get("before"), + "after": obj.get("after") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.before: str = None - self.after: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/room_created_message.py b/symphony/bdk/gen/agent_model/room_created_message.py index cec756b2..e232e06a 100644 --- a/symphony/bdk/gen/agent_model/room_created_message.py +++ b/symphony/bdk/gen/agent_model/room_created_message.py @@ -1,380 +1,118 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.agent_model.room_created_message_all_of import RoomCreatedMessageAllOf +from pydantic import ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.room_tag import RoomTag from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage -globals()['RoomCreatedMessageAllOf'] = RoomCreatedMessageAllOf -globals()['RoomTag'] = RoomTag -globals()['V2BaseMessage'] = V2BaseMessage - -class RoomCreatedMessage(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class RoomCreatedMessage(V2BaseMessage): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'timestamp': (str,), # noqa: E501 - 'v2message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'creation_date': (int, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'keywords': ([RoomTag], none_type), # noqa: E501 - 'description': (str, none_type), # noqa: E501 - 'created_by_user_id': (int, none_type), # noqa: E501 - 'read_only': (bool, none_type), # noqa: E501 - 'discoverable': (bool, none_type), # noqa: E501 - 'public': (bool, none_type), # noqa: E501 - 'members_can_invite': (bool, none_type), # noqa: E501 - 'copy_protected': (bool, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - val = { - } - if not val: - return None - return {'v2message_type': val} - - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - 'v2message_type': 'v2messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'creation_date': 'creationDate', # noqa: E501 - 'name': 'name', # noqa: E501 - 'keywords': 'keywords', # noqa: E501 - 'description': 'description', # noqa: E501 - 'created_by_user_id': 'createdByUserId', # noqa: E501 - 'read_only': 'readOnly', # noqa: E501 - 'discoverable': 'discoverable', # noqa: E501 - 'public': 'public', # noqa: E501 - 'members_can_invite': 'membersCanInvite', # noqa: E501 - 'copy_protected': 'copyProtected', # noqa: E501 - 'id': 'id', # noqa: E501 - } - - read_only_vars = { - } + Generated when a room is created. + """ # noqa: E501 + creation_date: Optional[StrictInt] = Field(default=None, alias="creationDate") + name: Optional[StrictStr] = None + keywords: Optional[List[RoomTag]] = None + description: Optional[StrictStr] = None + created_by_user_id: Optional[StrictInt] = Field(default=None, description="The Symphony userId of the user who created the room.", alias="createdByUserId") + read_only: Optional[StrictBool] = Field(default=None, alias="readOnly") + discoverable: Optional[StrictBool] = None + public: Optional[StrictBool] = None + members_can_invite: Optional[StrictBool] = Field(default=None, alias="membersCanInvite") + copy_protected: Optional[StrictBool] = Field(default=None, alias="copyProtected") + __properties: ClassVar[List[str]] = ["id", "timestamp", "v2messageType", "streamId", "creationDate", "name", "keywords", "description", "createdByUserId", "readOnly", "discoverable", "public", "membersCanInvite", "copyProtected"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomCreatedMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - creation_date (int): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - keywords ([RoomTag]): [optional] if omitted the server will use the default value of [] # noqa: E501 - description (str): [optional] # noqa: E501 - created_by_user_id (int): The Symphony userId of the user who created the room.. [optional] # noqa: E501 - read_only (bool): [optional] # noqa: E501 - discoverable (bool): [optional] # noqa: E501 - public (bool): [optional] # noqa: E501 - members_can_invite (bool): [optional] # noqa: E501 - copy_protected (bool): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomCreatedMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomCreatedMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - creation_date (int): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - keywords ([RoomTag]): [optional] if omitted the server will use the default value of [] # noqa: E501 - description (str): [optional] # noqa: E501 - created_by_user_id (int): The Symphony userId of the user who created the room.. [optional] # noqa: E501 - read_only (bool): [optional] # noqa: E501 - discoverable (bool): [optional] # noqa: E501 - public (bool): [optional] # noqa: E501 - members_can_invite (bool): [optional] # noqa: E501 - copy_protected (bool): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in keywords (list) + _items = [] + if self.keywords: + for _item_keywords in self.keywords: + if _item_keywords: + _items.append(_item_keywords.to_dict()) + _dict['keywords'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomCreatedMessage from a dict""" + if obj is None: + return None - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "timestamp": obj.get("timestamp"), + "v2messageType": obj.get("v2messageType"), + "streamId": obj.get("streamId"), + "creationDate": obj.get("creationDate"), + "name": obj.get("name"), + "keywords": [RoomTag.from_dict(_item) for _item in obj["keywords"]] if obj.get("keywords") is not None else None, + "description": obj.get("description"), + "createdByUserId": obj.get("createdByUserId"), + "readOnly": obj.get("readOnly"), + "discoverable": obj.get("discoverable"), + "public": obj.get("public"), + "membersCanInvite": obj.get("membersCanInvite"), + "copyProtected": obj.get("copyProtected") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.timestamp: str = kwargs['timestamp'] - self.v2message_type: str = kwargs['v2message_type'] - self.stream_id: str = kwargs['stream_id'] - self.creation_date: int = None - self.name: str = None - self.keywords: List[RoomTag] = [] - self.description: str = None - self.created_by_user_id: int = None - self.read_only: bool = None - self.discoverable: bool = None - self.public: bool = None - self.members_can_invite: bool = None - self.copy_protected: bool = None - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - RoomCreatedMessageAllOf, - V2BaseMessage, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/room_created_message_all_of.py b/symphony/bdk/gen/agent_model/room_created_message_all_of.py deleted file mode 100644 index 69f3108c..00000000 --- a/symphony/bdk/gen/agent_model/room_created_message_all_of.py +++ /dev/null @@ -1,304 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.room_tag import RoomTag -globals()['RoomTag'] = RoomTag - -class RoomCreatedMessageAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'creation_date': (int, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'keywords': ([RoomTag], none_type), # noqa: E501 - 'description': (str, none_type), # noqa: E501 - 'created_by_user_id': (int, none_type), # noqa: E501 - 'read_only': (bool, none_type), # noqa: E501 - 'discoverable': (bool, none_type), # noqa: E501 - 'public': (bool, none_type), # noqa: E501 - 'members_can_invite': (bool, none_type), # noqa: E501 - 'copy_protected': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'creation_date': 'creationDate', # noqa: E501 - 'name': 'name', # noqa: E501 - 'keywords': 'keywords', # noqa: E501 - 'description': 'description', # noqa: E501 - 'created_by_user_id': 'createdByUserId', # noqa: E501 - 'read_only': 'readOnly', # noqa: E501 - 'discoverable': 'discoverable', # noqa: E501 - 'public': 'public', # noqa: E501 - 'members_can_invite': 'membersCanInvite', # noqa: E501 - 'copy_protected': 'copyProtected', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomCreatedMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - creation_date (int): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - keywords ([RoomTag]): [optional] if omitted the server will use the default value of [] # noqa: E501 - description (str): [optional] # noqa: E501 - created_by_user_id (int): The Symphony userId of the user who created the room.. [optional] # noqa: E501 - read_only (bool): [optional] # noqa: E501 - discoverable (bool): [optional] # noqa: E501 - public (bool): [optional] # noqa: E501 - members_can_invite (bool): [optional] # noqa: E501 - copy_protected (bool): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomCreatedMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - creation_date (int): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - keywords ([RoomTag]): [optional] if omitted the server will use the default value of [] # noqa: E501 - description (str): [optional] # noqa: E501 - created_by_user_id (int): The Symphony userId of the user who created the room.. [optional] # noqa: E501 - read_only (bool): [optional] # noqa: E501 - discoverable (bool): [optional] # noqa: E501 - public (bool): [optional] # noqa: E501 - members_can_invite (bool): [optional] # noqa: E501 - copy_protected (bool): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.creation_date: int = None - self.name: str = None - self.keywords: List[RoomTag] = [] - self.description: str = None - self.created_by_user_id: int = None - self.read_only: bool = None - self.discoverable: bool = None - self.public: bool = None - self.members_can_invite: bool = None - self.copy_protected: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/room_deactivated_message.py b/symphony/bdk/gen/agent_model/room_deactivated_message.py index 19572342..6bfb4a42 100644 --- a/symphony/bdk/gen/agent_model/room_deactivated_message.py +++ b/symphony/bdk/gen/agent_model/room_deactivated_message.py @@ -1,333 +1,92 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.agent_model.room_deactivated_message_all_of import RoomDeactivatedMessageAllOf +from pydantic import ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage -globals()['RoomDeactivatedMessageAllOf'] = RoomDeactivatedMessageAllOf -globals()['V2BaseMessage'] = V2BaseMessage - -class RoomDeactivatedMessage(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class RoomDeactivatedMessage(V2BaseMessage): """ + Generated when a room is deactivated. + """ # noqa: E501 + deactivated_by_user_id: Optional[StrictInt] = Field(default=None, alias="deactivatedByUserId") + __properties: ClassVar[List[str]] = ["id", "timestamp", "v2messageType", "streamId", "deactivatedByUserId"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'timestamp': (str,), # noqa: E501 - 'v2message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'deactivated_by_user_id': (int, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - val = { - } - if not val: - return None - return {'v2message_type': val} - - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - 'v2message_type': 'v2messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'deactivated_by_user_id': 'deactivatedByUserId', # noqa: E501 - 'id': 'id', # noqa: E501 - } - - read_only_vars = { - } + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomDeactivatedMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - deactivated_by_user_id (int): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomDeactivatedMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomDeactivatedMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - deactivated_by_user_id (int): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomDeactivatedMessage from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "id": obj.get("id"), + "timestamp": obj.get("timestamp"), + "v2messageType": obj.get("v2messageType"), + "streamId": obj.get("streamId"), + "deactivatedByUserId": obj.get("deactivatedByUserId") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.timestamp: str = kwargs['timestamp'] - self.v2message_type: str = kwargs['v2message_type'] - self.stream_id: str = kwargs['stream_id'] - self.deactivated_by_user_id: int = None - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - RoomDeactivatedMessageAllOf, - V2BaseMessage, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/room_deactivated_message_all_of.py b/symphony/bdk/gen/agent_model/room_deactivated_message_all_of.py deleted file mode 100644 index 5cbb355d..00000000 --- a/symphony/bdk/gen/agent_model/room_deactivated_message_all_of.py +++ /dev/null @@ -1,256 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class RoomDeactivatedMessageAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'deactivated_by_user_id': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'deactivated_by_user_id': 'deactivatedByUserId', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomDeactivatedMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - deactivated_by_user_id (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomDeactivatedMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - deactivated_by_user_id (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.deactivated_by_user_id: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/room_member_demoted_from_owner_message.py b/symphony/bdk/gen/agent_model/room_member_demoted_from_owner_message.py index 8236be3d..0d4d8a5e 100644 --- a/symphony/bdk/gen/agent_model/room_member_demoted_from_owner_message.py +++ b/symphony/bdk/gen/agent_model/room_member_demoted_from_owner_message.py @@ -1,338 +1,94 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.agent_model.room_member_demoted_from_owner_message_all_of import RoomMemberDemotedFromOwnerMessageAllOf +from pydantic import ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage -globals()['RoomMemberDemotedFromOwnerMessageAllOf'] = RoomMemberDemotedFromOwnerMessageAllOf -globals()['V2BaseMessage'] = V2BaseMessage - -class RoomMemberDemotedFromOwnerMessage(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class RoomMemberDemotedFromOwnerMessage(V2BaseMessage): """ + Generated when a room member is promoted to owner. + """ # noqa: E501 + demoted_by_user_id: Optional[StrictInt] = Field(default=None, alias="demotedByUserId") + demoted_user_id: Optional[StrictInt] = Field(default=None, alias="demotedUserId") + __properties: ClassVar[List[str]] = ["id", "timestamp", "v2messageType", "streamId", "demotedByUserId", "demotedUserId"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'timestamp': (str,), # noqa: E501 - 'v2message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'demoted_by_user_id': (int, none_type), # noqa: E501 - 'demoted_user_id': (int, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - val = { - } - if not val: - return None - return {'v2message_type': val} - - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - 'v2message_type': 'v2messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'demoted_by_user_id': 'demotedByUserId', # noqa: E501 - 'demoted_user_id': 'demotedUserId', # noqa: E501 - 'id': 'id', # noqa: E501 - } - - read_only_vars = { - } + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomMemberDemotedFromOwnerMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - demoted_by_user_id (int): [optional] # noqa: E501 - demoted_user_id (int): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomMemberDemotedFromOwnerMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomMemberDemotedFromOwnerMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - demoted_by_user_id (int): [optional] # noqa: E501 - demoted_user_id (int): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomMemberDemotedFromOwnerMessage from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "id": obj.get("id"), + "timestamp": obj.get("timestamp"), + "v2messageType": obj.get("v2messageType"), + "streamId": obj.get("streamId"), + "demotedByUserId": obj.get("demotedByUserId"), + "demotedUserId": obj.get("demotedUserId") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.timestamp: str = kwargs['timestamp'] - self.v2message_type: str = kwargs['v2message_type'] - self.stream_id: str = kwargs['stream_id'] - self.demoted_by_user_id: int = None - self.demoted_user_id: int = None - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - RoomMemberDemotedFromOwnerMessageAllOf, - V2BaseMessage, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/room_member_demoted_from_owner_message_all_of.py b/symphony/bdk/gen/agent_model/room_member_demoted_from_owner_message_all_of.py deleted file mode 100644 index bb2277af..00000000 --- a/symphony/bdk/gen/agent_model/room_member_demoted_from_owner_message_all_of.py +++ /dev/null @@ -1,261 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class RoomMemberDemotedFromOwnerMessageAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'demoted_by_user_id': (int, none_type), # noqa: E501 - 'demoted_user_id': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'demoted_by_user_id': 'demotedByUserId', # noqa: E501 - 'demoted_user_id': 'demotedUserId', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomMemberDemotedFromOwnerMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - demoted_by_user_id (int): [optional] # noqa: E501 - demoted_user_id (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomMemberDemotedFromOwnerMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - demoted_by_user_id (int): [optional] # noqa: E501 - demoted_user_id (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.demoted_by_user_id: int = None - self.demoted_user_id: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/room_member_promoted_to_owner_message.py b/symphony/bdk/gen/agent_model/room_member_promoted_to_owner_message.py index 11a36240..0777a077 100644 --- a/symphony/bdk/gen/agent_model/room_member_promoted_to_owner_message.py +++ b/symphony/bdk/gen/agent_model/room_member_promoted_to_owner_message.py @@ -1,338 +1,94 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.agent_model.room_member_promoted_to_owner_message_all_of import RoomMemberPromotedToOwnerMessageAllOf +from pydantic import ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage -globals()['RoomMemberPromotedToOwnerMessageAllOf'] = RoomMemberPromotedToOwnerMessageAllOf -globals()['V2BaseMessage'] = V2BaseMessage - -class RoomMemberPromotedToOwnerMessage(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class RoomMemberPromotedToOwnerMessage(V2BaseMessage): """ + Generated when a room member is promoted to owner. + """ # noqa: E501 + promoted_by_user_id: Optional[StrictInt] = Field(default=None, alias="promotedByUserId") + promoted_user_id: Optional[StrictInt] = Field(default=None, alias="promotedUserId") + __properties: ClassVar[List[str]] = ["id", "timestamp", "v2messageType", "streamId", "promotedByUserId", "promotedUserId"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'timestamp': (str,), # noqa: E501 - 'v2message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'promoted_by_user_id': (int, none_type), # noqa: E501 - 'promoted_user_id': (int, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - val = { - } - if not val: - return None - return {'v2message_type': val} - - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - 'v2message_type': 'v2messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'promoted_by_user_id': 'promotedByUserId', # noqa: E501 - 'promoted_user_id': 'promotedUserId', # noqa: E501 - 'id': 'id', # noqa: E501 - } - - read_only_vars = { - } + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomMemberPromotedToOwnerMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - promoted_by_user_id (int): [optional] # noqa: E501 - promoted_user_id (int): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomMemberPromotedToOwnerMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomMemberPromotedToOwnerMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - promoted_by_user_id (int): [optional] # noqa: E501 - promoted_user_id (int): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomMemberPromotedToOwnerMessage from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "id": obj.get("id"), + "timestamp": obj.get("timestamp"), + "v2messageType": obj.get("v2messageType"), + "streamId": obj.get("streamId"), + "promotedByUserId": obj.get("promotedByUserId"), + "promotedUserId": obj.get("promotedUserId") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.timestamp: str = kwargs['timestamp'] - self.v2message_type: str = kwargs['v2message_type'] - self.stream_id: str = kwargs['stream_id'] - self.promoted_by_user_id: int = None - self.promoted_user_id: int = None - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - RoomMemberPromotedToOwnerMessageAllOf, - V2BaseMessage, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/room_member_promoted_to_owner_message_all_of.py b/symphony/bdk/gen/agent_model/room_member_promoted_to_owner_message_all_of.py deleted file mode 100644 index 01a10782..00000000 --- a/symphony/bdk/gen/agent_model/room_member_promoted_to_owner_message_all_of.py +++ /dev/null @@ -1,261 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class RoomMemberPromotedToOwnerMessageAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'promoted_by_user_id': (int, none_type), # noqa: E501 - 'promoted_user_id': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'promoted_by_user_id': 'promotedByUserId', # noqa: E501 - 'promoted_user_id': 'promotedUserId', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomMemberPromotedToOwnerMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - promoted_by_user_id (int): [optional] # noqa: E501 - promoted_user_id (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomMemberPromotedToOwnerMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - promoted_by_user_id (int): [optional] # noqa: E501 - promoted_user_id (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.promoted_by_user_id: int = None - self.promoted_user_id: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/room_reactivated_message.py b/symphony/bdk/gen/agent_model/room_reactivated_message.py index 03be5a33..f144e129 100644 --- a/symphony/bdk/gen/agent_model/room_reactivated_message.py +++ b/symphony/bdk/gen/agent_model/room_reactivated_message.py @@ -1,333 +1,92 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.agent_model.room_reactivated_message_all_of import RoomReactivatedMessageAllOf +from pydantic import ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage -globals()['RoomReactivatedMessageAllOf'] = RoomReactivatedMessageAllOf -globals()['V2BaseMessage'] = V2BaseMessage - -class RoomReactivatedMessage(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class RoomReactivatedMessage(V2BaseMessage): """ + Generated when a room is reactivated. + """ # noqa: E501 + reactivated_by_user_id: Optional[StrictInt] = Field(default=None, alias="reactivatedByUserId") + __properties: ClassVar[List[str]] = ["id", "timestamp", "v2messageType", "streamId", "reactivatedByUserId"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'timestamp': (str,), # noqa: E501 - 'v2message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'reactivated_by_user_id': (int, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - val = { - } - if not val: - return None - return {'v2message_type': val} - - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - 'v2message_type': 'v2messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'reactivated_by_user_id': 'reactivatedByUserId', # noqa: E501 - 'id': 'id', # noqa: E501 - } - - read_only_vars = { - } + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomReactivatedMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - reactivated_by_user_id (int): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomReactivatedMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomReactivatedMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - reactivated_by_user_id (int): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomReactivatedMessage from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "id": obj.get("id"), + "timestamp": obj.get("timestamp"), + "v2messageType": obj.get("v2messageType"), + "streamId": obj.get("streamId"), + "reactivatedByUserId": obj.get("reactivatedByUserId") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.timestamp: str = kwargs['timestamp'] - self.v2message_type: str = kwargs['v2message_type'] - self.stream_id: str = kwargs['stream_id'] - self.reactivated_by_user_id: int = None - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - RoomReactivatedMessageAllOf, - V2BaseMessage, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/room_reactivated_message_all_of.py b/symphony/bdk/gen/agent_model/room_reactivated_message_all_of.py deleted file mode 100644 index bbd99e1d..00000000 --- a/symphony/bdk/gen/agent_model/room_reactivated_message_all_of.py +++ /dev/null @@ -1,256 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class RoomReactivatedMessageAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'reactivated_by_user_id': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'reactivated_by_user_id': 'reactivatedByUserId', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomReactivatedMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - reactivated_by_user_id (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomReactivatedMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - reactivated_by_user_id (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.reactivated_by_user_id: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/room_tag.py b/symphony/bdk/gen/agent_model/room_tag.py index 4214eb81..f71675d1 100644 --- a/symphony/bdk/gen/agent_model/room_tag.py +++ b/symphony/bdk/gen/agent_model/room_tag.py @@ -1,267 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class RoomTag(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'key': (str,), # noqa: E501 - 'value': (str,), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class RoomTag(BaseModel): + """ + Room Tag object. A key:value pair describing additional properties of the room. + """ # noqa: E501 + key: StrictStr = Field(description="A unique label of the Tag.") + value: StrictStr = Field(description="The value of this Tag's label.") + __properties: ClassVar[List[str]] = ["key", "value"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'key': 'key', # noqa: E501 - 'value': 'value', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, key, value, *args, **kwargs): # noqa: E501 - """RoomTag - a agent_model defined in OpenAPI - - Args: - key (str): A unique label of the Tag. - value (str): The value of this Tag's label. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomTag from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.key = key - self.value = value - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, key, value, *args, **kwargs): # noqa: E501 - """RoomTag - a agent_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - key (str): A unique label of the Tag. - value (str): The value of this Tag's label. + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomTag from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.key: str = key - self.value: str = value - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/room_updated_message.py b/symphony/bdk/gen/agent_model/room_updated_message.py index 39ae2ec2..fa82c52c 100644 --- a/symphony/bdk/gen/agent_model/room_updated_message.py +++ b/symphony/bdk/gen/agent_model/room_updated_message.py @@ -1,375 +1,116 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.room_tag import RoomTag -from symphony.bdk.gen.agent_model.room_updated_message_all_of import RoomUpdatedMessageAllOf from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage -globals()['RoomTag'] = RoomTag -globals()['RoomUpdatedMessageAllOf'] = RoomUpdatedMessageAllOf -globals()['V2BaseMessage'] = V2BaseMessage - -class RoomUpdatedMessage(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class RoomUpdatedMessage(V2BaseMessage): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'timestamp': (str,), # noqa: E501 - 'v2message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'old_name': (str, none_type), # noqa: E501 - 'new_name': (str, none_type), # noqa: E501 - 'keywords': ([RoomTag], none_type), # noqa: E501 - 'old_description': (str, none_type), # noqa: E501 - 'new_description': (str, none_type), # noqa: E501 - 'members_can_invite': (bool, none_type), # noqa: E501 - 'discoverable': (bool, none_type), # noqa: E501 - 'read_only': (bool, none_type), # noqa: E501 - 'copy_protected': (bool, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - val = { - } - if not val: - return None - return {'v2message_type': val} - - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - 'v2message_type': 'v2messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'old_name': 'oldName', # noqa: E501 - 'new_name': 'newName', # noqa: E501 - 'keywords': 'keywords', # noqa: E501 - 'old_description': 'oldDescription', # noqa: E501 - 'new_description': 'newDescription', # noqa: E501 - 'members_can_invite': 'membersCanInvite', # noqa: E501 - 'discoverable': 'discoverable', # noqa: E501 - 'read_only': 'readOnly', # noqa: E501 - 'copy_protected': 'copyProtected', # noqa: E501 - 'id': 'id', # noqa: E501 - } - - read_only_vars = { - } + Generated when a room is updated. + """ # noqa: E501 + old_name: Optional[StrictStr] = Field(default=None, alias="oldName") + new_name: Optional[StrictStr] = Field(default=None, alias="newName") + keywords: Optional[List[RoomTag]] = None + old_description: Optional[StrictStr] = Field(default=None, alias="oldDescription") + new_description: Optional[StrictStr] = Field(default=None, alias="newDescription") + members_can_invite: Optional[StrictBool] = Field(default=None, alias="membersCanInvite") + discoverable: Optional[StrictBool] = None + read_only: Optional[StrictBool] = Field(default=None, alias="readOnly") + copy_protected: Optional[StrictBool] = Field(default=None, alias="copyProtected") + __properties: ClassVar[List[str]] = ["id", "timestamp", "v2messageType", "streamId", "oldName", "newName", "keywords", "oldDescription", "newDescription", "membersCanInvite", "discoverable", "readOnly", "copyProtected"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomUpdatedMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - old_name (str): [optional] # noqa: E501 - new_name (str): [optional] # noqa: E501 - keywords ([RoomTag]): [optional] if omitted the server will use the default value of [] # noqa: E501 - old_description (str): [optional] # noqa: E501 - new_description (str): [optional] # noqa: E501 - members_can_invite (bool): [optional] # noqa: E501 - discoverable (bool): [optional] # noqa: E501 - read_only (bool): [optional] # noqa: E501 - copy_protected (bool): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomUpdatedMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomUpdatedMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - old_name (str): [optional] # noqa: E501 - new_name (str): [optional] # noqa: E501 - keywords ([RoomTag]): [optional] if omitted the server will use the default value of [] # noqa: E501 - old_description (str): [optional] # noqa: E501 - new_description (str): [optional] # noqa: E501 - members_can_invite (bool): [optional] # noqa: E501 - discoverable (bool): [optional] # noqa: E501 - read_only (bool): [optional] # noqa: E501 - copy_protected (bool): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in keywords (list) + _items = [] + if self.keywords: + for _item_keywords in self.keywords: + if _item_keywords: + _items.append(_item_keywords.to_dict()) + _dict['keywords'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomUpdatedMessage from a dict""" + if obj is None: + return None - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "timestamp": obj.get("timestamp"), + "v2messageType": obj.get("v2messageType"), + "streamId": obj.get("streamId"), + "oldName": obj.get("oldName"), + "newName": obj.get("newName"), + "keywords": [RoomTag.from_dict(_item) for _item in obj["keywords"]] if obj.get("keywords") is not None else None, + "oldDescription": obj.get("oldDescription"), + "newDescription": obj.get("newDescription"), + "membersCanInvite": obj.get("membersCanInvite"), + "discoverable": obj.get("discoverable"), + "readOnly": obj.get("readOnly"), + "copyProtected": obj.get("copyProtected") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.timestamp: str = kwargs['timestamp'] - self.v2message_type: str = kwargs['v2message_type'] - self.stream_id: str = kwargs['stream_id'] - self.old_name: str = None - self.new_name: str = None - self.keywords: List[RoomTag] = [] - self.old_description: str = None - self.new_description: str = None - self.members_can_invite: bool = None - self.discoverable: bool = None - self.read_only: bool = None - self.copy_protected: bool = None - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - RoomUpdatedMessageAllOf, - V2BaseMessage, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/room_updated_message_all_of.py b/symphony/bdk/gen/agent_model/room_updated_message_all_of.py deleted file mode 100644 index 6bfba079..00000000 --- a/symphony/bdk/gen/agent_model/room_updated_message_all_of.py +++ /dev/null @@ -1,299 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.room_tag import RoomTag -globals()['RoomTag'] = RoomTag - -class RoomUpdatedMessageAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'old_name': (str, none_type), # noqa: E501 - 'new_name': (str, none_type), # noqa: E501 - 'keywords': ([RoomTag], none_type), # noqa: E501 - 'old_description': (str, none_type), # noqa: E501 - 'new_description': (str, none_type), # noqa: E501 - 'members_can_invite': (bool, none_type), # noqa: E501 - 'discoverable': (bool, none_type), # noqa: E501 - 'read_only': (bool, none_type), # noqa: E501 - 'copy_protected': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'old_name': 'oldName', # noqa: E501 - 'new_name': 'newName', # noqa: E501 - 'keywords': 'keywords', # noqa: E501 - 'old_description': 'oldDescription', # noqa: E501 - 'new_description': 'newDescription', # noqa: E501 - 'members_can_invite': 'membersCanInvite', # noqa: E501 - 'discoverable': 'discoverable', # noqa: E501 - 'read_only': 'readOnly', # noqa: E501 - 'copy_protected': 'copyProtected', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomUpdatedMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - old_name (str): [optional] # noqa: E501 - new_name (str): [optional] # noqa: E501 - keywords ([RoomTag]): [optional] if omitted the server will use the default value of [] # noqa: E501 - old_description (str): [optional] # noqa: E501 - new_description (str): [optional] # noqa: E501 - members_can_invite (bool): [optional] # noqa: E501 - discoverable (bool): [optional] # noqa: E501 - read_only (bool): [optional] # noqa: E501 - copy_protected (bool): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomUpdatedMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - old_name (str): [optional] # noqa: E501 - new_name (str): [optional] # noqa: E501 - keywords ([RoomTag]): [optional] if omitted the server will use the default value of [] # noqa: E501 - old_description (str): [optional] # noqa: E501 - new_description (str): [optional] # noqa: E501 - members_can_invite (bool): [optional] # noqa: E501 - discoverable (bool): [optional] # noqa: E501 - read_only (bool): [optional] # noqa: E501 - copy_protected (bool): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.old_name: str = None - self.new_name: str = None - self.keywords: List[RoomTag] = [] - self.old_description: str = None - self.new_description: str = None - self.members_can_invite: bool = None - self.discoverable: bool = None - self.read_only: bool = None - self.copy_protected: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/share_article.py b/symphony/bdk/gen/agent_model/share_article.py index 87960102..3cb0fde2 100644 --- a/symphony/bdk/gen/agent_model/share_article.py +++ b/symphony/bdk/gen/agent_model/share_article.py @@ -1,324 +1,111 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 +# coding: utf-8 - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class ShareArticle(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'title': (str,), # noqa: E501 - 'publisher': (str,), # noqa: E501 - 'author': (str,), # noqa: E501 - 'app_id': (str,), # noqa: E501 - 'article_id': (str, none_type), # noqa: E501 - 'sub_title': (str, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - 'publish_date': (int, none_type), # noqa: E501 - 'thumbnail_url': (str, none_type), # noqa: E501 - 'article_url': (str, none_type), # noqa: E501 - 'summary': (str, none_type), # noqa: E501 - 'app_name': (str, none_type), # noqa: E501 - 'app_icon_url': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'title': 'title', # noqa: E501 - 'publisher': 'publisher', # noqa: E501 - 'author': 'author', # noqa: E501 - 'app_id': 'appId', # noqa: E501 - 'article_id': 'articleId', # noqa: E501 - 'sub_title': 'subTitle', # noqa: E501 - 'message': 'message', # noqa: E501 - 'publish_date': 'publishDate', # noqa: E501 - 'thumbnail_url': 'thumbnailUrl', # noqa: E501 - 'article_url': 'articleUrl', # noqa: E501 - 'summary': 'summary', # noqa: E501 - 'app_name': 'appName', # noqa: E501 - 'app_icon_url': 'appIconUrl', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class ShareArticle(BaseModel): + """ + ShareArticle + """ # noqa: E501 + article_id: Optional[StrictStr] = Field(default=None, description="An ID for this article that should be unique to the calling application. Either an articleId or an articleUrl is required. ", alias="articleId") + title: StrictStr = Field(description="The title of the article") + sub_title: Optional[StrictStr] = Field(default=None, description="The subtitle of the article", alias="subTitle") + message: Optional[StrictStr] = Field(default=None, description="The message text that can be send along with the shared article") + publisher: StrictStr = Field(description="Publisher of the article") + publish_date: Optional[StrictInt] = Field(default=None, description="Article publish date in unix timestamp", alias="publishDate") + thumbnail_url: Optional[StrictStr] = Field(default=None, description="Url to the thumbnail image", alias="thumbnailUrl") + author: StrictStr = Field(description="Author of the article") + article_url: Optional[StrictStr] = Field(default=None, description="Url to the article", alias="articleUrl") + summary: Optional[StrictStr] = Field(default=None, description="Preview summary of the article") + app_id: StrictStr = Field(description="App ID of the calling application", alias="appId") + app_name: Optional[StrictStr] = Field(default=None, description="App name of the calling application", alias="appName") + app_icon_url: Optional[StrictStr] = Field(default=None, description="App icon url of the calling application", alias="appIconUrl") + __properties: ClassVar[List[str]] = ["articleId", "title", "subTitle", "message", "publisher", "publishDate", "thumbnailUrl", "author", "articleUrl", "summary", "appId", "appName", "appIconUrl"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, title, publisher, author, app_id, *args, **kwargs): # noqa: E501 - """ShareArticle - a agent_model defined in OpenAPI - - Args: - title (str): The title of the article - publisher (str): Publisher of the article - author (str): Author of the article - app_id (str): App ID of the calling application - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - article_id (str): An ID for this article that should be unique to the calling application. Either an articleId or an articleUrl is required. . [optional] # noqa: E501 - sub_title (str): The subtitle of the article. [optional] # noqa: E501 - message (str): The message text that can be send along with the shared article. [optional] # noqa: E501 - publish_date (int): Article publish date in unix timestamp. [optional] # noqa: E501 - thumbnail_url (str): Url to the thumbnail image. [optional] # noqa: E501 - article_url (str): Url to the article. [optional] # noqa: E501 - summary (str): Preview summary of the article. [optional] # noqa: E501 - app_name (str): App name of the calling application. [optional] # noqa: E501 - app_icon_url (str): App icon url of the calling application. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ShareArticle from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self.title = title - self.publisher = publisher - self.author = author - self.app_id = app_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, title, publisher, author, app_id, *args, **kwargs): # noqa: E501 - """ShareArticle - a agent_model defined in OpenAPI - - Args: - title (str): The title of the article - publisher (str): Publisher of the article - author (str): Author of the article - app_id (str): App ID of the calling application - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - article_id (str): An ID for this article that should be unique to the calling application. Either an articleId or an articleUrl is required. . [optional] # noqa: E501 - sub_title (str): The subtitle of the article. [optional] # noqa: E501 - message (str): The message text that can be send along with the shared article. [optional] # noqa: E501 - publish_date (int): Article publish date in unix timestamp. [optional] # noqa: E501 - thumbnail_url (str): Url to the thumbnail image. [optional] # noqa: E501 - article_url (str): Url to the article. [optional] # noqa: E501 - summary (str): Preview summary of the article. [optional] # noqa: E501 - app_name (str): App name of the calling application. [optional] # noqa: E501 - app_icon_url (str): App icon url of the calling application. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ShareArticle from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "articleId": obj.get("articleId"), + "title": obj.get("title"), + "subTitle": obj.get("subTitle"), + "message": obj.get("message"), + "publisher": obj.get("publisher"), + "publishDate": obj.get("publishDate"), + "thumbnailUrl": obj.get("thumbnailUrl"), + "author": obj.get("author"), + "articleUrl": obj.get("articleUrl"), + "summary": obj.get("summary"), + "appId": obj.get("appId"), + "appName": obj.get("appName"), + "appIconUrl": obj.get("appIconUrl") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.title: str = title - self.publisher: str = publisher - self.author: str = author - self.app_id: str = app_id - self.article_id: str = None - self.sub_title: str = None - self.message: str = None - self.publish_date: int = None - self.thumbnail_url: str = None - self.article_url: str = None - self.summary: str = None - self.app_name: str = None - self.app_icon_url: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/share_content.py b/symphony/bdk/gen/agent_model/share_content.py index 1eea1614..aedf7adb 100644 --- a/symphony/bdk/gen/agent_model/share_content.py +++ b/symphony/bdk/gen/agent_model/share_content.py @@ -1,264 +1,93 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.share_article import ShareArticle -globals()['ShareArticle'] = ShareArticle +from typing import Optional, Set +from typing_extensions import Self -class ShareContent(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ShareContent(BaseModel): """ + ShareContent + """ # noqa: E501 + type: Optional[StrictStr] = Field(default=None, description="Type of content to be shared. Currently only support \"com.symphony.sharing.article\"") + content: Optional[ShareArticle] = None + __properties: ClassVar[List[str]] = ["type", "content"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str, none_type), # noqa: E501 - 'content': (ShareArticle, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'type': 'type', # noqa: E501 - 'content': 'content', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ShareContent - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): Type of content to be shared. Currently only support \"com.symphony.sharing.article\". [optional] # noqa: E501 - content (ShareArticle): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ShareContent from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ShareContent - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): Type of content to be shared. Currently only support \"com.symphony.sharing.article\". [optional] # noqa: E501 - content (ShareArticle): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of content + if self.content: + _dict['content'] = self.content.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ShareContent from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type"), + "content": ShareArticle.from_dict(obj["content"]) if obj.get("content") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = None - self.content: ShareArticle = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/signal.py b/symphony/bdk/gen/agent_model/signal.py index acda86d8..90366a75 100644 --- a/symphony/bdk/gen/agent_model/signal.py +++ b/symphony/bdk/gen/agent_model/signal.py @@ -1,335 +1,97 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.agent_model.base_signal import BaseSignal -from symphony.bdk.gen.agent_model.signal_all_of import SignalAllOf -globals()['BaseSignal'] = BaseSignal -globals()['SignalAllOf'] = SignalAllOf -class Signal(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class Signal(BaseModel): """ + Signal + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Signal name") + query: Optional[StrictStr] = Field(default=None, description="The query used to define this signal. The query is defined as \"field:value\" pairs combined by the operators \"AND\" or \"OR\". Supported fields are (case-insensitive): \"author\", \"hashtag\" and \"cashtag\". MUST contain at least one \"hashtag\" or \"cashtag\" definition. ") + visible_on_profile: Optional[StrictBool] = Field(default=None, description="Whether the signal is visible on its creator's profile", alias="visibleOnProfile") + company_wide: Optional[StrictBool] = Field(default=None, description="Whether the signal is a push signal", alias="companyWide") + id: Optional[StrictStr] = Field(default=None, description="Signal ID") + timestamp: Optional[StrictInt] = Field(default=None, description="Timestamp when the signal was created, in milliseconds since Jan 1 1970") + __properties: ClassVar[List[str]] = ["name", "query", "visibleOnProfile", "companyWide", "id", "timestamp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Signal from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'name': (str, none_type), # noqa: E501 - 'query': (str, none_type), # noqa: E501 - 'visible_on_profile': (bool, none_type), # noqa: E501 - 'company_wide': (bool, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - 'timestamp': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'name': 'name', # noqa: E501 - 'query': 'query', # noqa: E501 - 'visible_on_profile': 'visibleOnProfile', # noqa: E501 - 'company_wide': 'companyWide', # noqa: E501 - 'id': 'id', # noqa: E501 - 'timestamp': 'timestamp', # noqa: E501 - } - - read_only_vars = { - } + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Signal - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Signal name. [optional] # noqa: E501 - query (str): The query used to define this signal. The query is defined as \"field:value\" pairs combined by the operators \"AND\" or \"OR\". Supported fields are (case-insensitive): \"author\", \"hashtag\" and \"cashtag\". MUST contain at least one \"hashtag\" or \"cashtag\" definition. . [optional] # noqa: E501 - visible_on_profile (bool): Whether the signal is visible on its creator's profile. [optional] # noqa: E501 - company_wide (bool): Whether the signal is a push signal. [optional] # noqa: E501 - id (str): Signal ID. [optional] # noqa: E501 - timestamp (int): Timestamp when the signal was created, in milliseconds since Jan 1 1970. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Signal - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Signal name. [optional] # noqa: E501 - query (str): The query used to define this signal. The query is defined as \"field:value\" pairs combined by the operators \"AND\" or \"OR\". Supported fields are (case-insensitive): \"author\", \"hashtag\" and \"cashtag\". MUST contain at least one \"hashtag\" or \"cashtag\" definition. . [optional] # noqa: E501 - visible_on_profile (bool): Whether the signal is visible on its creator's profile. [optional] # noqa: E501 - company_wide (bool): Whether the signal is a push signal. [optional] # noqa: E501 - id (str): Signal ID. [optional] # noqa: E501 - timestamp (int): Timestamp when the signal was created, in milliseconds since Jan 1 1970. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Signal from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "name": obj.get("name"), + "query": obj.get("query"), + "visibleOnProfile": obj.get("visibleOnProfile"), + "companyWide": obj.get("companyWide"), + "id": obj.get("id"), + "timestamp": obj.get("timestamp") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.name: str = None - self.query: str = None - self.visible_on_profile: bool = None - self.company_wide: bool = None - self.id: str = None - self.timestamp: int = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - BaseSignal, - SignalAllOf, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/signal_all_of.py b/symphony/bdk/gen/agent_model/signal_all_of.py deleted file mode 100644 index 8f30e15c..00000000 --- a/symphony/bdk/gen/agent_model/signal_all_of.py +++ /dev/null @@ -1,261 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class SignalAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'timestamp': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'timestamp': 'timestamp', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """SignalAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Signal ID. [optional] # noqa: E501 - timestamp (int): Timestamp when the signal was created, in milliseconds since Jan 1 1970. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """SignalAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Signal ID. [optional] # noqa: E501 - timestamp (int): Timestamp when the signal was created, in milliseconds since Jan 1 1970. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.id: str = None - self.timestamp: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/signal_list.py b/symphony/bdk/gen/agent_model/signal_list.py deleted file mode 100644 index d145a189..00000000 --- a/symphony/bdk/gen/agent_model/signal_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.signal import Signal -globals()['Signal'] = Signal - -class SignalList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([Signal],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """SignalList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Signal]): # noqa: E501 - - Keyword Args: - value ([Signal]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[Signal] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """SignalList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Signal]): # noqa: E501 - - Keyword Args: - value ([Signal]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/simple_message.py b/symphony/bdk/gen/agent_model/simple_message.py index 92fa8eef..58575df0 100644 --- a/symphony/bdk/gen/agent_model/simple_message.py +++ b/symphony/bdk/gen/agent_model/simple_message.py @@ -1,256 +1,87 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class SimpleMessage(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class SimpleMessage(BaseModel): + """ + A string wrapped in a JSON object. + """ # noqa: E501 + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["message"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'message': 'message', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """SimpleMessage - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimpleMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """SimpleMessage - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimpleMessage from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "message": obj.get("message") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/success_response.py b/symphony/bdk/gen/agent_model/success_response.py index e5bcbce8..41d802d8 100644 --- a/symphony/bdk/gen/agent_model/success_response.py +++ b/symphony/bdk/gen/agent_model/success_response.py @@ -1,265 +1,99 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class SuccessResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class SuccessResponse(BaseModel): """ + SuccessResponse + """ # noqa: E501 + format: Optional[StrictStr] = None + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["format", "message"] + + @field_validator('format') + def format_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['TEXT', 'XML']): + raise ValueError("must be one of enum values ('TEXT', 'XML')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('format',): { - 'TEXT': "TEXT", - 'XML': "XML", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SuccessResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'format': (str, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'format': 'format', # noqa: E501 - 'message': 'message', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """SuccessResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """SuccessResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SuccessResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "format": obj.get("format"), + "message": obj.get("message") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.format: str = None - self.message: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/user_joined_room_message.py b/symphony/bdk/gen/agent_model/user_joined_room_message.py index b28a2f0a..3dbac0f0 100644 --- a/symphony/bdk/gen/agent_model/user_joined_room_message.py +++ b/symphony/bdk/gen/agent_model/user_joined_room_message.py @@ -1,338 +1,94 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.agent_model.user_joined_room_message_all_of import UserJoinedRoomMessageAllOf +from pydantic import ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage -globals()['UserJoinedRoomMessageAllOf'] = UserJoinedRoomMessageAllOf -globals()['V2BaseMessage'] = V2BaseMessage - -class UserJoinedRoomMessage(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserJoinedRoomMessage(V2BaseMessage): """ + Generated when a user joins a room. + """ # noqa: E501 + added_by_user_id: Optional[StrictInt] = Field(default=None, alias="addedByUserId") + member_added_user_id: Optional[StrictInt] = Field(default=None, alias="memberAddedUserId") + __properties: ClassVar[List[str]] = ["id", "timestamp", "v2messageType", "streamId", "addedByUserId", "memberAddedUserId"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'timestamp': (str,), # noqa: E501 - 'v2message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'added_by_user_id': (int, none_type), # noqa: E501 - 'member_added_user_id': (int, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - val = { - } - if not val: - return None - return {'v2message_type': val} - - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - 'v2message_type': 'v2messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'added_by_user_id': 'addedByUserId', # noqa: E501 - 'member_added_user_id': 'memberAddedUserId', # noqa: E501 - 'id': 'id', # noqa: E501 - } - - read_only_vars = { - } + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserJoinedRoomMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - added_by_user_id (int): [optional] # noqa: E501 - member_added_user_id (int): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserJoinedRoomMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserJoinedRoomMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - added_by_user_id (int): [optional] # noqa: E501 - member_added_user_id (int): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserJoinedRoomMessage from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "id": obj.get("id"), + "timestamp": obj.get("timestamp"), + "v2messageType": obj.get("v2messageType"), + "streamId": obj.get("streamId"), + "addedByUserId": obj.get("addedByUserId"), + "memberAddedUserId": obj.get("memberAddedUserId") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.timestamp: str = kwargs['timestamp'] - self.v2message_type: str = kwargs['v2message_type'] - self.stream_id: str = kwargs['stream_id'] - self.added_by_user_id: int = None - self.member_added_user_id: int = None - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - UserJoinedRoomMessageAllOf, - V2BaseMessage, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/user_joined_room_message_all_of.py b/symphony/bdk/gen/agent_model/user_joined_room_message_all_of.py deleted file mode 100644 index 64b996dd..00000000 --- a/symphony/bdk/gen/agent_model/user_joined_room_message_all_of.py +++ /dev/null @@ -1,261 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserJoinedRoomMessageAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'added_by_user_id': (int, none_type), # noqa: E501 - 'member_added_user_id': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'added_by_user_id': 'addedByUserId', # noqa: E501 - 'member_added_user_id': 'memberAddedUserId', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserJoinedRoomMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - added_by_user_id (int): [optional] # noqa: E501 - member_added_user_id (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserJoinedRoomMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - added_by_user_id (int): [optional] # noqa: E501 - member_added_user_id (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.added_by_user_id: int = None - self.member_added_user_id: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/user_left_room_message.py b/symphony/bdk/gen/agent_model/user_left_room_message.py index 5b594ef1..9227bcb5 100644 --- a/symphony/bdk/gen/agent_model/user_left_room_message.py +++ b/symphony/bdk/gen/agent_model/user_left_room_message.py @@ -1,343 +1,96 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.agent_model.user_left_room_message_all_of import UserLeftRoomMessageAllOf +from pydantic import ConfigDict, Field, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage -globals()['UserLeftRoomMessageAllOf'] = UserLeftRoomMessageAllOf -globals()['V2BaseMessage'] = V2BaseMessage - -class UserLeftRoomMessage(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserLeftRoomMessage(V2BaseMessage): """ + Generated when a user leaves a room. + """ # noqa: E501 + removed_by_user_id: Optional[StrictInt] = Field(default=None, alias="removedByUserId") + member_left_user_id: Optional[StrictInt] = Field(default=None, alias="memberLeftUserId") + information_barrier_remediation: Optional[StrictBool] = Field(default=None, alias="informationBarrierRemediation") + __properties: ClassVar[List[str]] = ["id", "timestamp", "v2messageType", "streamId", "removedByUserId", "memberLeftUserId", "informationBarrierRemediation"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'timestamp': (str,), # noqa: E501 - 'v2message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'removed_by_user_id': (int, none_type), # noqa: E501 - 'member_left_user_id': (int, none_type), # noqa: E501 - 'information_barrier_remediation': (bool, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - val = { - } - if not val: - return None - return {'v2message_type': val} - - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - 'v2message_type': 'v2messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'removed_by_user_id': 'removedByUserId', # noqa: E501 - 'member_left_user_id': 'memberLeftUserId', # noqa: E501 - 'information_barrier_remediation': 'informationBarrierRemediation', # noqa: E501 - 'id': 'id', # noqa: E501 - } - - read_only_vars = { - } + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserLeftRoomMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - removed_by_user_id (int): [optional] # noqa: E501 - member_left_user_id (int): [optional] # noqa: E501 - information_barrier_remediation (bool): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserLeftRoomMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserLeftRoomMessage - a agent_model defined in OpenAPI - - Keyword Args: - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - removed_by_user_id (int): [optional] # noqa: E501 - member_left_user_id (int): [optional] # noqa: E501 - information_barrier_remediation (bool): [optional] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserLeftRoomMessage from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "id": obj.get("id"), + "timestamp": obj.get("timestamp"), + "v2messageType": obj.get("v2messageType"), + "streamId": obj.get("streamId"), + "removedByUserId": obj.get("removedByUserId"), + "memberLeftUserId": obj.get("memberLeftUserId"), + "informationBarrierRemediation": obj.get("informationBarrierRemediation") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.timestamp: str = kwargs['timestamp'] - self.v2message_type: str = kwargs['v2message_type'] - self.stream_id: str = kwargs['stream_id'] - self.removed_by_user_id: int = None - self.member_left_user_id: int = None - self.information_barrier_remediation: bool = None - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - UserLeftRoomMessageAllOf, - V2BaseMessage, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/user_left_room_message_all_of.py b/symphony/bdk/gen/agent_model/user_left_room_message_all_of.py deleted file mode 100644 index f164d94c..00000000 --- a/symphony/bdk/gen/agent_model/user_left_room_message_all_of.py +++ /dev/null @@ -1,266 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserLeftRoomMessageAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'removed_by_user_id': (int, none_type), # noqa: E501 - 'member_left_user_id': (int, none_type), # noqa: E501 - 'information_barrier_remediation': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'removed_by_user_id': 'removedByUserId', # noqa: E501 - 'member_left_user_id': 'memberLeftUserId', # noqa: E501 - 'information_barrier_remediation': 'informationBarrierRemediation', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserLeftRoomMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - removed_by_user_id (int): [optional] # noqa: E501 - member_left_user_id (int): [optional] # noqa: E501 - information_barrier_remediation (bool): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserLeftRoomMessageAllOf - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - removed_by_user_id (int): [optional] # noqa: E501 - member_left_user_id (int): [optional] # noqa: E501 - information_barrier_remediation (bool): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.removed_by_user_id: int = None - self.member_left_user_id: int = None - self.information_barrier_remediation: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_audit_trail_initiator_list.py b/symphony/bdk/gen/agent_model/v1_audit_trail_initiator_list.py index 2aa17e63..27d21c5f 100644 --- a/symphony/bdk/gen/agent_model/v1_audit_trail_initiator_list.py +++ b/symphony/bdk/gen/agent_model/v1_audit_trail_initiator_list.py @@ -1,266 +1,101 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.pagination import Pagination from symphony.bdk.gen.agent_model.v1_audit_trail_initiator_response import V1AuditTrailInitiatorResponse -globals()['Pagination'] = Pagination -globals()['V1AuditTrailInitiatorResponse'] = V1AuditTrailInitiatorResponse +from typing import Optional, Set +from typing_extensions import Self -class V1AuditTrailInitiatorList(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1AuditTrailInitiatorList(BaseModel): """ + V1AuditTrailInitiatorList + """ # noqa: E501 + items: Optional[List[V1AuditTrailInitiatorResponse]] = None + pagination: Optional[Pagination] = None + __properties: ClassVar[List[str]] = ["items", "pagination"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'items': ([V1AuditTrailInitiatorResponse], none_type), # noqa: E501 - 'pagination': (Pagination, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'items': 'items', # noqa: E501 - 'pagination': 'pagination', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1AuditTrailInitiatorList - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - items ([V1AuditTrailInitiatorResponse]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1AuditTrailInitiatorList from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1AuditTrailInitiatorList - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - items ([V1AuditTrailInitiatorResponse]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1AuditTrailInitiatorList from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "items": [V1AuditTrailInitiatorResponse.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.items: List[V1AuditTrailInitiatorResponse] = None - self.pagination: Pagination = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_audit_trail_initiator_response.py b/symphony/bdk/gen/agent_model/v1_audit_trail_initiator_response.py index 225d4e6e..e1b5f2ec 100644 --- a/symphony/bdk/gen/agent_model/v1_audit_trail_initiator_response.py +++ b/symphony/bdk/gen/agent_model/v1_audit_trail_initiator_response.py @@ -1,281 +1,97 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class V1AuditTrailInitiatorResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1AuditTrailInitiatorResponse(BaseModel): """ + Audit Trail Initiator object response. The attributes may vary according to the action. There are different types of action and each action could have specific attributes. + """ # noqa: E501 + action: Optional[StrictStr] = Field(default=None, description="The audit trail action that has peformed") + action_name: Optional[StrictStr] = Field(default=None, description="The audit trail action name that has peformed", alias="actionName") + timestamp: Optional[StrictStr] = Field(default=None, description="The timestamp when the action has occurred") + initiator_id: Optional[StrictStr] = Field(default=None, description="The user's id that has performed the action", alias="initiatorId") + initiator_username: Optional[StrictStr] = Field(default=None, description="The username that has performed the action", alias="initiatorUsername") + initiator_email_address: Optional[StrictStr] = Field(default=None, description="The user's e-mail address that has performed the action", alias="initiatorEmailAddress") + __properties: ClassVar[List[str]] = ["action", "actionName", "timestamp", "initiatorId", "initiatorUsername", "initiatorEmailAddress"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1AuditTrailInitiatorResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'action': (str, none_type), # noqa: E501 - 'action_name': (str, none_type), # noqa: E501 - 'timestamp': (str, none_type), # noqa: E501 - 'initiator_id': (str, none_type), # noqa: E501 - 'initiator_username': (str, none_type), # noqa: E501 - 'initiator_email_address': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'action': 'action', # noqa: E501 - 'action_name': 'actionName', # noqa: E501 - 'timestamp': 'timestamp', # noqa: E501 - 'initiator_id': 'initiatorId', # noqa: E501 - 'initiator_username': 'initiatorUsername', # noqa: E501 - 'initiator_email_address': 'initiatorEmailAddress', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1AuditTrailInitiatorResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - action (str): The audit trail action that has peformed. [optional] # noqa: E501 - action_name (str): The audit trail action name that has peformed. [optional] # noqa: E501 - timestamp (str): The timestamp when the action has occurred. [optional] # noqa: E501 - initiator_id (str): The user's id that has performed the action. [optional] # noqa: E501 - initiator_username (str): The username that has performed the action. [optional] # noqa: E501 - initiator_email_address (str): The user's e-mail address that has performed the action. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1AuditTrailInitiatorResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - action (str): The audit trail action that has peformed. [optional] # noqa: E501 - action_name (str): The audit trail action name that has peformed. [optional] # noqa: E501 - timestamp (str): The timestamp when the action has occurred. [optional] # noqa: E501 - initiator_id (str): The user's id that has performed the action. [optional] # noqa: E501 - initiator_username (str): The username that has performed the action. [optional] # noqa: E501 - initiator_email_address (str): The user's e-mail address that has performed the action. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1AuditTrailInitiatorResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "action": obj.get("action"), + "actionName": obj.get("actionName"), + "timestamp": obj.get("timestamp"), + "initiatorId": obj.get("initiatorId"), + "initiatorUsername": obj.get("initiatorUsername"), + "initiatorEmailAddress": obj.get("initiatorEmailAddress") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.action: str = None - self.action_name: str = None - self.timestamp: str = None - self.initiator_id: str = None - self.initiator_username: str = None - self.initiator_email_address: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_content_type.py b/symphony/bdk/gen/agent_model/v1_dlp_content_type.py index b794bc1a..077c280c 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_content_type.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_content_type.py @@ -1,256 +1,87 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V1DLPContentType(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V1DLPContentType(BaseModel): + """ + A representation of content type of message sent by a user of Symphony (message/stream/signal) + """ # noqa: E501 + type: Optional[StrictStr] = Field(default=None, description="content type") + __properties: ClassVar[List[str]] = ["type"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'type': 'type', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1DLPContentType - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): content type. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPContentType from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1DLPContentType - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): content type. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPContentType from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_dictionary.py b/symphony/bdk/gen/agent_model/v1_dlp_dictionary.py index e6b259e6..94f40d0d 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_dictionary.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_dictionary.py @@ -1,271 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_dictionary_content import V1DLPDictionaryContent from symphony.bdk.gen.agent_model.v1_dlp_dictionary_metadata import V1DLPDictionaryMetadata -globals()['V1DLPDictionaryContent'] = V1DLPDictionaryContent -globals()['V1DLPDictionaryMetadata'] = V1DLPDictionaryMetadata - -class V1DLPDictionary(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPDictionary(BaseModel): """ + Dictionary object + """ # noqa: E501 + content: Optional[V1DLPDictionaryContent] = None + dictionary_metadata: V1DLPDictionaryMetadata = Field(alias="dictionaryMetadata") + __properties: ClassVar[List[str]] = ["content", "dictionaryMetadata"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'dictionary_metadata': (V1DLPDictionaryMetadata,), # noqa: E501 - 'content': (V1DLPDictionaryContent, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'dictionary_metadata': 'dictionaryMetadata', # noqa: E501 - 'content': 'content', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, dictionary_metadata, *args, **kwargs): # noqa: E501 - """V1DLPDictionary - a agent_model defined in OpenAPI - - Args: - dictionary_metadata (V1DLPDictionaryMetadata): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - content (V1DLPDictionaryContent): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPDictionary from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.dictionary_metadata = dictionary_metadata - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, dictionary_metadata, *args, **kwargs): # noqa: E501 - """V1DLPDictionary - a agent_model defined in OpenAPI - - Args: - dictionary_metadata (V1DLPDictionaryMetadata): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - content (V1DLPDictionaryContent): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of content + if self.content: + _dict['content'] = self.content.to_dict() + # override the default output from pydantic by calling `to_dict()` of dictionary_metadata + if self.dictionary_metadata: + _dict['dictionaryMetadata'] = self.dictionary_metadata.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPDictionary from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "content": V1DLPDictionaryContent.from_dict(obj["content"]) if obj.get("content") is not None else None, + "dictionaryMetadata": V1DLPDictionaryMetadata.from_dict(obj["dictionaryMetadata"]) if obj.get("dictionaryMetadata") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.dictionary_metadata: V1DLPDictionaryMetadata = dictionary_metadata - self.content: V1DLPDictionaryContent = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_content.py b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_content.py index f07264f0..bea67a0d 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_content.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_content.py @@ -1,266 +1,91 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V1DLPDictionaryContent(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'data': (str, none_type), # noqa: E501 - 'num_keywords': (int, none_type), # noqa: E501 - 'md5': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V1DLPDictionaryContent(BaseModel): + """ + Content of a dictionary + """ # noqa: E501 + data: Optional[StrictStr] = Field(default=None, description="A comma separated string which contains a lot of keywords/regexes.") + num_keywords: Optional[StrictInt] = Field(default=None, description="Number of Keywords in dictionary", alias="numKeywords") + md5: Optional[StrictStr] = Field(default=None, description="MD5 value of the content") + __properties: ClassVar[List[str]] = ["data", "numKeywords", "md5"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'data': 'data', # noqa: E501 - 'num_keywords': 'numKeywords', # noqa: E501 - 'md5': 'md5', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryContent - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data (str): A comma separated string which contains a lot of keywords/regexes.. [optional] # noqa: E501 - num_keywords (int): Number of Keywords in dictionary. [optional] # noqa: E501 - md5 (str): MD5 value of the content. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPDictionaryContent from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryContent - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data (str): A comma separated string which contains a lot of keywords/regexes.. [optional] # noqa: E501 - num_keywords (int): Number of Keywords in dictionary. [optional] # noqa: E501 - md5 (str): MD5 value of the content. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPDictionaryContent from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "data": obj.get("data"), + "numKeywords": obj.get("numKeywords"), + "md5": obj.get("md5") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.data: str = None - self.num_keywords: int = None - self.md5: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata.py b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata.py index 69973c9f..31bd0a7b 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata.py @@ -1,285 +1,99 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_dictionary_ref import V1DLPDictionaryRef -globals()['V1DLPDictionaryRef'] = V1DLPDictionaryRef - -class V1DLPDictionaryMetadata(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPDictionaryMetadata(BaseModel): """ + Dictionary's metadata (excluding content) + """ # noqa: E501 + creation_date: Optional[StrictInt] = Field(default=None, description="Creation time of the dictionary in milliseconds elapsed as of epoch time.", alias="creationDate") + creator_id: Optional[StrictStr] = Field(default=None, description="Numeric userId of the creator", alias="creatorId") + dict_ref: V1DLPDictionaryRef = Field(alias="dictRef") + last_updated_date: Optional[StrictInt] = Field(default=None, description="The recent update time of the dictionary in milliseconds", alias="lastUpdatedDate") + type: StrictStr = Field(description="The type of dictionary, which specify the content is a list of words or a list of regexes. By default set to \"Word\" if not specified. Possible values - Word, Regex ") + __properties: ClassVar[List[str]] = ["creationDate", "creatorId", "dictRef", "lastUpdatedDate", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPDictionaryMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'dict_ref': (V1DLPDictionaryRef,), # noqa: E501 - 'type': (str,), # noqa: E501 - 'creation_date': (int, none_type), # noqa: E501 - 'creator_id': (str, none_type), # noqa: E501 - 'last_updated_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'dict_ref': 'dictRef', # noqa: E501 - 'type': 'type', # noqa: E501 - 'creation_date': 'creationDate', # noqa: E501 - 'creator_id': 'creatorId', # noqa: E501 - 'last_updated_date': 'lastUpdatedDate', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of dict_ref + if self.dict_ref: + _dict['dictRef'] = self.dict_ref.to_dict() + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, dict_ref, type, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryMetadata - a agent_model defined in OpenAPI - - Args: - dict_ref (V1DLPDictionaryRef): - type (str): The type of dictionary, which specify the content is a list of words or a list of regexes. By default set to \"Word\" if not specified. Possible values - Word, Regex - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - creation_date (int): Creation time of the dictionary in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - creator_id (str): Numeric userId of the creator. [optional] # noqa: E501 - last_updated_date (int): The recent update time of the dictionary in milliseconds. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.dict_ref = dict_ref - self.type = type - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, dict_ref, type, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryMetadata - a agent_model defined in OpenAPI - - Args: - dict_ref (V1DLPDictionaryRef): - type (str): The type of dictionary, which specify the content is a list of words or a list of regexes. By default set to \"Word\" if not specified. Possible values - Word, Regex - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - creation_date (int): Creation time of the dictionary in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - creator_id (str): Numeric userId of the creator. [optional] # noqa: E501 - last_updated_date (int): The recent update time of the dictionary in milliseconds. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPDictionaryMetadata from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "creationDate": obj.get("creationDate"), + "creatorId": obj.get("creatorId"), + "dictRef": V1DLPDictionaryRef.from_dict(obj["dictRef"]) if obj.get("dictRef") is not None else None, + "lastUpdatedDate": obj.get("lastUpdatedDate"), + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.dict_ref: V1DLPDictionaryRef = dict_ref - self.type: str = type - self.creation_date: int = None - self.creator_id: str = None - self.last_updated_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_collection_response.py b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_collection_response.py index 27a887f8..775f1f1c 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_collection_response.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_collection_response.py @@ -1,274 +1,99 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_dictionary_metadata import V1DLPDictionaryMetadata -globals()['V1DLPDictionaryMetadata'] = V1DLPDictionaryMetadata - -class V1DLPDictionaryMetadataCollectionResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPDictionaryMetadataCollectionResponse(BaseModel): """ + List of dictionary metadata. + """ # noqa: E501 + items: List[V1DLPDictionaryMetadata] = Field(description="List of dictionary metadata") + page: Optional[StrictInt] = Field(default=None, description="Page number of current page") + page_count: Optional[StrictInt] = Field(default=None, description="Total number of pages available", alias="pageCount") + __properties: ClassVar[List[str]] = ["items", "page", "pageCount"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'items': ([V1DLPDictionaryMetadata],), # noqa: E501 - 'page': (int, none_type), # noqa: E501 - 'page_count': (int, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'items': 'items', # noqa: E501 - 'page': 'page', # noqa: E501 - 'page_count': 'pageCount', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, items, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryMetadataCollectionResponse - a agent_model defined in OpenAPI - - Args: - items ([V1DLPDictionaryMetadata]): List of dictionary metadata - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - page (int): Page number of current page. [optional] # noqa: E501 - page_count (int): Total number of pages available. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPDictionaryMetadataCollectionResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.items = items - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, items, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryMetadataCollectionResponse - a agent_model defined in OpenAPI - - Args: - items ([V1DLPDictionaryMetadata]): List of dictionary metadata - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - page (int): Page number of current page. [optional] # noqa: E501 - page_count (int): Total number of pages available. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in items (list) + _items = [] + if self.items: + for _item_items in self.items: + if _item_items: + _items.append(_item_items.to_dict()) + _dict['items'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPDictionaryMetadataCollectionResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "items": [V1DLPDictionaryMetadata.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "page": obj.get("page"), + "pageCount": obj.get("pageCount") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.items: List[V1DLPDictionaryMetadata] = items - self.page: int = None - self.page_count: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_create_request.py b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_create_request.py index 496d76da..e98aa2ed 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_create_request.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_create_request.py @@ -1,267 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V1DLPDictionaryMetadataCreateRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str,), # noqa: E501 - 'type': (str,), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V1DLPDictionaryMetadataCreateRequest(BaseModel): + """ + Dictionary's metadata (excluding content) to use for dictionary create operations. + """ # noqa: E501 + name: StrictStr = Field(description="The name of dictionary ") + type: StrictStr = Field(description="The type of dictionary, which specify the content is a list of words or a list of regexes. By default set to \"Word\" if not specified. Possible values - Word, Regex ") + __properties: ClassVar[List[str]] = ["name", "type"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'name': 'name', # noqa: E501 - 'type': 'type', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, name, type, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryMetadataCreateRequest - a agent_model defined in OpenAPI - - Args: - name (str): The name of dictionary - type (str): The type of dictionary, which specify the content is a list of words or a list of regexes. By default set to \"Word\" if not specified. Possible values - Word, Regex - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPDictionaryMetadataCreateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - self.type = type - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, name, type, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryMetadataCreateRequest - a agent_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - name (str): The name of dictionary - type (str): The type of dictionary, which specify the content is a list of words or a list of regexes. By default set to \"Word\" if not specified. Possible values - Word, Regex + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPDictionaryMetadataCreateRequest from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = name - self.type: str = type - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_response.py b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_response.py index 8e1a5c61..4d2379e0 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_response.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_response.py @@ -1,264 +1,91 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List from symphony.bdk.gen.agent_model.v1_dlp_dictionary_metadata import V1DLPDictionaryMetadata -globals()['V1DLPDictionaryMetadata'] = V1DLPDictionaryMetadata - -class V1DLPDictionaryMetadataResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPDictionaryMetadataResponse(BaseModel): """ + Dictionary response containing dictionary metadata. + """ # noqa: E501 + data: V1DLPDictionaryMetadata + __properties: ClassVar[List[str]] = ["data"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'data': (V1DLPDictionaryMetadata,), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'data': 'data', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, data, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryMetadataResponse - a agent_model defined in OpenAPI - - Args: - data (V1DLPDictionaryMetadata): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPDictionaryMetadataResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.data = data - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, data, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryMetadataResponse - a agent_model defined in OpenAPI - - Args: - data (V1DLPDictionaryMetadata): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPDictionaryMetadataResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "data": V1DLPDictionaryMetadata.from_dict(obj["data"]) if obj.get("data") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.data: V1DLPDictionaryMetadata = data - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_update_request.py b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_update_request.py index 37e1bcd4..113b7c8e 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_update_request.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_metadata_update_request.py @@ -1,261 +1,87 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V1DLPDictionaryMetadataUpdateRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str,), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V1DLPDictionaryMetadataUpdateRequest(BaseModel): + """ + Dictionary's metadata (excluding content) to use for dictionary update operations. + """ # noqa: E501 + name: StrictStr = Field(description="The name of dictionary") + __properties: ClassVar[List[str]] = ["name"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'name': 'name', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, name, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryMetadataUpdateRequest - a agent_model defined in OpenAPI - - Args: - name (str): The name of dictionary - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPDictionaryMetadataUpdateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, name, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryMetadataUpdateRequest - a agent_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - name (str): The name of dictionary + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPDictionaryMetadataUpdateRequest from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = name - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_ref.py b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_ref.py index c604f944..3c74d814 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_dictionary_ref.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_dictionary_ref.py @@ -1,271 +1,91 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V1DLPDictionaryRef(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str,), # noqa: E501 - 'dict_id': (str, none_type), # noqa: E501 - 'version': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V1DLPDictionaryRef(BaseModel): + """ + Basic information needed to identify a dictionary + """ # noqa: E501 + dict_id: Optional[StrictStr] = Field(default=None, description="Unique dictionary id", alias="dictId") + name: StrictStr = Field(description="Unique name of a dictionary, max 30 characters, with trimmed leading and trailing blank spaces.") + version: Optional[StrictStr] = Field(default=None, description="The version of a dictionary, in format \"major.minor\". Initial value will set by backend as \"1.0\" when created. Whenever the dictionary version needs to be changed, the minor version by 1 unless minor == 999, then the major version is increased by 1 until it reaches 999. ") + __properties: ClassVar[List[str]] = ["dictId", "name", "version"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'name': 'name', # noqa: E501 - 'dict_id': 'dictId', # noqa: E501 - 'version': 'version', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, name, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryRef - a agent_model defined in OpenAPI - - Args: - name (str): Unique name of a dictionary, max 30 characters, with trimmed leading and trailing blank spaces. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - dict_id (str): Unique dictionary id. [optional] # noqa: E501 - version (str): The version of a dictionary, in format \"major.minor\". Initial value will set by backend as \"1.0\" when created. Whenever the dictionary version needs to be changed, the minor version by 1 unless minor == 999, then the major version is increased by 1 until it reaches 999. . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPDictionaryRef from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, name, *args, **kwargs): # noqa: E501 - """V1DLPDictionaryRef - a agent_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - name (str): Unique name of a dictionary, max 30 characters, with trimmed leading and trailing blank spaces. + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - dict_id (str): Unique dictionary id. [optional] # noqa: E501 - version (str): The version of a dictionary, in format \"major.minor\". Initial value will set by backend as \"1.0\" when created. Whenever the dictionary version needs to be changed, the minor version by 1 unless minor == 999, then the major version is increased by 1 until it reaches 999. . [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPDictionaryRef from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "dictId": obj.get("dictId"), + "name": obj.get("name"), + "version": obj.get("version") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = name - self.dict_id: str = None - self.version: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_matched_policy.py b/symphony/bdk/gen/agent_model/v1_dlp_matched_policy.py index cdf6ca06..e823e59d 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_matched_policy.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_matched_policy.py @@ -1,281 +1,97 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class V1DLPMatchedPolicy(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPMatchedPolicy(BaseModel): """ + A representation of policy that matched the violation with a list of matched keywords in the policy + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Id of the policy") + version: Optional[StrictStr] = Field(default=None, description="Version of the policy") + policy_name: Optional[StrictStr] = Field(default=None, description="Name of the policy", alias="policyName") + type: Optional[StrictStr] = Field(default=None, description="Whether BLOCK or WARN") + terms: Optional[StrictStr] = Field(default=None, description="List of decrypted matched keywords in the policy") + diagnostic: Optional[StrictStr] = Field(default=None, description="A diagnostic message containing an error message in the event that the decryption of terms failed. May also be present in the case of a successful call if there is useful narrative to return. ") + __properties: ClassVar[List[str]] = ["id", "version", "policyName", "type", "terms", "diagnostic"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPMatchedPolicy from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (str, none_type), # noqa: E501 - 'version': (str, none_type), # noqa: E501 - 'policy_name': (str, none_type), # noqa: E501 - 'type': (str, none_type), # noqa: E501 - 'terms': (str, none_type), # noqa: E501 - 'diagnostic': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'id': 'id', # noqa: E501 - 'version': 'version', # noqa: E501 - 'policy_name': 'policyName', # noqa: E501 - 'type': 'type', # noqa: E501 - 'terms': 'terms', # noqa: E501 - 'diagnostic': 'diagnostic', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1DLPMatchedPolicy - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Id of the policy. [optional] # noqa: E501 - version (str): Version of the policy. [optional] # noqa: E501 - policy_name (str): Name of the policy. [optional] # noqa: E501 - type (str): Whether BLOCK or WARN. [optional] # noqa: E501 - terms (str): List of decrypted matched keywords in the policy. [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the decryption of terms failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1DLPMatchedPolicy - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Id of the policy. [optional] # noqa: E501 - version (str): Version of the policy. [optional] # noqa: E501 - policy_name (str): Name of the policy. [optional] # noqa: E501 - type (str): Whether BLOCK or WARN. [optional] # noqa: E501 - terms (str): List of decrypted matched keywords in the policy. [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the decryption of terms failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPMatchedPolicy from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "version": obj.get("version"), + "policyName": obj.get("policyName"), + "type": obj.get("type"), + "terms": obj.get("terms"), + "diagnostic": obj.get("diagnostic") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.version: str = None - self.policy_name: str = None - self.type: str = None - self.terms: str = None - self.diagnostic: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_matched_policy_list.py b/symphony/bdk/gen/agent_model/v1_dlp_matched_policy_list.py deleted file mode 100644 index db0347ef..00000000 --- a/symphony/bdk/gen/agent_model/v1_dlp_matched_policy_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.v1_dlp_matched_policy import V1DLPMatchedPolicy -globals()['V1DLPMatchedPolicy'] = V1DLPMatchedPolicy - -class V1DLPMatchedPolicyList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V1DLPMatchedPolicy],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V1DLPMatchedPolicyList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V1DLPMatchedPolicy]): List of policies that matched the violation.. # noqa: E501 - - Keyword Args: - value ([V1DLPMatchedPolicy]): List of policies that matched the violation.. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V1DLPMatchedPolicy] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V1DLPMatchedPolicyList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V1DLPMatchedPolicy]): List of policies that matched the violation.. # noqa: E501 - - Keyword Args: - value ([V1DLPMatchedPolicy]): List of policies that matched the violation.. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/v1_dlp_outcome.py b/symphony/bdk/gen/agent_model/v1_dlp_outcome.py index 0e0cdcca..0d2b54d8 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_outcome.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_outcome.py @@ -1,256 +1,87 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V1DLPOutcome(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V1DLPOutcome(BaseModel): + """ + A representation of outcome of DLP message/stream/signal sent by a user of Symphony + """ # noqa: E501 + type: Optional[StrictStr] = Field(default=None, description="Outcome of DLP enforcement") + __properties: ClassVar[List[str]] = ["type"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'type': 'type', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1DLPOutcome - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): Outcome of DLP enforcement. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPOutcome from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1DLPOutcome - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): Outcome of DLP enforcement. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPOutcome from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_policies_collection_response.py b/symphony/bdk/gen/agent_model/v1_dlp_policies_collection_response.py index dbf96994..66a67cbf 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_policies_collection_response.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_policies_collection_response.py @@ -1,274 +1,99 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_policy import V1DLPPolicy -globals()['V1DLPPolicy'] = V1DLPPolicy - -class V1DLPPoliciesCollectionResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPPoliciesCollectionResponse(BaseModel): """ + List of policies + """ # noqa: E501 + policies: List[V1DLPPolicy] = Field(description="List of policies") + page: Optional[StrictInt] = Field(default=None, description="Page number of current page") + page_count: Optional[StrictInt] = Field(default=None, description="Total number of pages available", alias="pageCount") + __properties: ClassVar[List[str]] = ["policies", "page", "pageCount"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'policies': ([V1DLPPolicy],), # noqa: E501 - 'page': (int, none_type), # noqa: E501 - 'page_count': (int, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'policies': 'policies', # noqa: E501 - 'page': 'page', # noqa: E501 - 'page_count': 'pageCount', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, policies, *args, **kwargs): # noqa: E501 - """V1DLPPoliciesCollectionResponse - a agent_model defined in OpenAPI - - Args: - policies ([V1DLPPolicy]): List of policies - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - page (int): Page number of current page. [optional] # noqa: E501 - page_count (int): Total number of pages available. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPPoliciesCollectionResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.policies = policies - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, policies, *args, **kwargs): # noqa: E501 - """V1DLPPoliciesCollectionResponse - a agent_model defined in OpenAPI - - Args: - policies ([V1DLPPolicy]): List of policies - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - page (int): Page number of current page. [optional] # noqa: E501 - page_count (int): Total number of pages available. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in policies (list) + _items = [] + if self.policies: + for _item_policies in self.policies: + if _item_policies: + _items.append(_item_policies.to_dict()) + _dict['policies'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPPoliciesCollectionResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "policies": [V1DLPPolicy.from_dict(_item) for _item in obj["policies"]] if obj.get("policies") is not None else None, + "page": obj.get("page"), + "pageCount": obj.get("pageCount") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.policies: List[V1DLPPolicy] = policies - self.page: int = None - self.page_count: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_policy.py b/symphony/bdk/gen/agent_model/v1_dlp_policy.py index 76588228..43838e97 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_policy.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_policy.py @@ -1,323 +1,117 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_dictionary_ref import V1DLPDictionaryRef -globals()['V1DLPDictionaryRef'] = V1DLPDictionaryRef - -class V1DLPPolicy(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPPolicy(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'content_types': ([str],), # noqa: E501 - 'dictionary_refs': ([V1DLPDictionaryRef],), # noqa: E501 - 'name': (str,), # noqa: E501 - 'scopes': ([str],), # noqa: E501 - 'type': (str,), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'creation_date': (int, none_type), # noqa: E501 - 'creator_id': (str, none_type), # noqa: E501 - 'last_disabled_date': (int, none_type), # noqa: E501 - 'last_updated_date': (int, none_type), # noqa: E501 - 'policy_id': (str, none_type), # noqa: E501 - 'version': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'content_types': 'contentTypes', # noqa: E501 - 'dictionary_refs': 'dictionaryRefs', # noqa: E501 - 'name': 'name', # noqa: E501 - 'scopes': 'scopes', # noqa: E501 - 'type': 'type', # noqa: E501 - 'active': 'active', # noqa: E501 - 'creation_date': 'creationDate', # noqa: E501 - 'creator_id': 'creatorId', # noqa: E501 - 'last_disabled_date': 'lastDisabledDate', # noqa: E501 - 'last_updated_date': 'lastUpdatedDate', # noqa: E501 - 'policy_id': 'policyId', # noqa: E501 - 'version': 'version', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + The policy object for expression filter, one policy can have multiple dictionaries + """ # noqa: E501 + active: Optional[StrictBool] = Field(default=None, description="Indicate whether the policy is active or not") + content_types: List[StrictStr] = Field(description="The list of content types that policy should apply to. Cannot be empty. Policy content types could be either of \"Messages\", \"RoomMeta\", \"SignalMeta\". Default is set to [\"Messages\"] if not specified. ", alias="contentTypes") + creation_date: Optional[StrictInt] = Field(default=None, description="Creation time of the policy in milliseconds elapsed as of epoch time.", alias="creationDate") + creator_id: Optional[StrictStr] = Field(default=None, description="Numeric userId of the creator", alias="creatorId") + dictionary_refs: List[V1DLPDictionaryRef] = Field(description="List of dictionaries.", alias="dictionaryRefs") + last_disabled_date: Optional[StrictInt] = Field(default=None, description="Recent disable time of the policy in milliseconds elapsed as of epoch time.", alias="lastDisabledDate") + last_updated_date: Optional[StrictInt] = Field(default=None, description="Recent update time of the policy in milliseconds elapsed as of epoch time.", alias="lastUpdatedDate") + name: StrictStr = Field(description="Unique name of a policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed.") + policy_id: Optional[StrictStr] = Field(default=None, description="Policy Id", alias="policyId") + scopes: List[StrictStr] = Field(description="List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. ") + type: StrictStr = Field(description="Type of policy. Possible values \"Block\" or \"Warn\".") + version: Optional[StrictStr] = Field(default=None, description="The version of a dictionary, in format \"major.minor\". Initial value will set by backend as \"1.0\" when created. Whenever the dictionary version needs to be changed, the minor version by 1 unless minor == 999, then the major version is increased by 1 until it reaches 999. ") + __properties: ClassVar[List[str]] = ["active", "contentTypes", "creationDate", "creatorId", "dictionaryRefs", "lastDisabledDate", "lastUpdatedDate", "name", "policyId", "scopes", "type", "version"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, content_types, dictionary_refs, name, scopes, type, *args, **kwargs): # noqa: E501 - """V1DLPPolicy - a agent_model defined in OpenAPI - - Args: - content_types ([str]): The list of content types that policy should apply to. Cannot be empty. Policy content types could be either of \"Messages\", \"RoomMeta\", \"SignalMeta\". Default is set to [\"Messages\"] if not specified. - dictionary_refs ([V1DLPDictionaryRef]): List of dictionaries. - name (str): Unique name of a policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed. - scopes ([str]): List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. - type (str): Type of policy. Possible values \"Block\" or \"Warn\". - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - active (bool): Indicate whether the policy is active or not. [optional] # noqa: E501 - creation_date (int): Creation time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - creator_id (str): Numeric userId of the creator. [optional] # noqa: E501 - last_disabled_date (int): Recent disable time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - last_updated_date (int): Recent update time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - policy_id (str): Policy Id. [optional] # noqa: E501 - version (str): The version of a dictionary, in format \"major.minor\". Initial value will set by backend as \"1.0\" when created. Whenever the dictionary version needs to be changed, the minor version by 1 unless minor == 999, then the major version is increased by 1 until it reaches 999. . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPPolicy from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.content_types = content_types - self.dictionary_refs = dictionary_refs - self.name = name - self.scopes = scopes - self.type = type - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, content_types, dictionary_refs, name, scopes, type, *args, **kwargs): # noqa: E501 - """V1DLPPolicy - a agent_model defined in OpenAPI - - Args: - content_types ([str]): The list of content types that policy should apply to. Cannot be empty. Policy content types could be either of \"Messages\", \"RoomMeta\", \"SignalMeta\". Default is set to [\"Messages\"] if not specified. - dictionary_refs ([V1DLPDictionaryRef]): List of dictionaries. - name (str): Unique name of a policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed. - scopes ([str]): List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. - type (str): Type of policy. Possible values \"Block\" or \"Warn\". - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - active (bool): Indicate whether the policy is active or not. [optional] # noqa: E501 - creation_date (int): Creation time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - creator_id (str): Numeric userId of the creator. [optional] # noqa: E501 - last_disabled_date (int): Recent disable time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - last_updated_date (int): Recent update time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - policy_id (str): Policy Id. [optional] # noqa: E501 - version (str): The version of a dictionary, in format \"major.minor\". Initial value will set by backend as \"1.0\" when created. Whenever the dictionary version needs to be changed, the minor version by 1 unless minor == 999, then the major version is increased by 1 until it reaches 999. . [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in dictionary_refs (list) + _items = [] + if self.dictionary_refs: + for _item_dictionary_refs in self.dictionary_refs: + if _item_dictionary_refs: + _items.append(_item_dictionary_refs.to_dict()) + _dict['dictionaryRefs'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPPolicy from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "active": obj.get("active"), + "contentTypes": obj.get("contentTypes"), + "creationDate": obj.get("creationDate"), + "creatorId": obj.get("creatorId"), + "dictionaryRefs": [V1DLPDictionaryRef.from_dict(_item) for _item in obj["dictionaryRefs"]] if obj.get("dictionaryRefs") is not None else None, + "lastDisabledDate": obj.get("lastDisabledDate"), + "lastUpdatedDate": obj.get("lastUpdatedDate"), + "name": obj.get("name"), + "policyId": obj.get("policyId"), + "scopes": obj.get("scopes"), + "type": obj.get("type"), + "version": obj.get("version") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.content_types: List[str] = content_types - self.dictionary_refs: List[V1DLPDictionaryRef] = dictionary_refs - self.name: str = name - self.scopes: List[str] = scopes - self.type: str = type - self.active: bool = None - self.creation_date: int = None - self.creator_id: str = None - self.last_disabled_date: int = None - self.last_updated_date: int = None - self.policy_id: str = None - self.version: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_policy_request.py b/symphony/bdk/gen/agent_model/v1_dlp_policy_request.py index b3617308..73740e2b 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_policy_request.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_policy_request.py @@ -1,285 +1,95 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class V1DLPPolicyRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPPolicyRequest(BaseModel): """ + The policy object to use for creating/updating a policy. + """ # noqa: E501 + content_types: List[StrictStr] = Field(description="The list of content types that policy should apply to. Cannot be empty. Policy content types could be either of \"Messages\", \"RoomMeta\", \"SignalMeta\". Default is set to [\"Messages\"] if not specified. ", alias="contentTypes") + dictionary_ids: List[StrictStr] = Field(description="List of dictionaries Ids for the policy.", alias="dictionaryIds") + name: StrictStr = Field(description="Unique name of a policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed.") + scopes: List[StrictStr] = Field(description="List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. ") + type: StrictStr = Field(description="Type of policy. Possible values \"Block\" or \"Warn\".") + __properties: ClassVar[List[str]] = ["contentTypes", "dictionaryIds", "name", "scopes", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPPolicyRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'content_types': ([str],), # noqa: E501 - 'dictionary_ids': ([str],), # noqa: E501 - 'name': (str,), # noqa: E501 - 'scopes': ([str],), # noqa: E501 - 'type': (str,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - + excluded_fields: Set[str] = set([ + ]) - attribute_map = { - 'content_types': 'contentTypes', # noqa: E501 - 'dictionary_ids': 'dictionaryIds', # noqa: E501 - 'name': 'name', # noqa: E501 - 'scopes': 'scopes', # noqa: E501 - 'type': 'type', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, content_types, dictionary_ids, name, scopes, type, *args, **kwargs): # noqa: E501 - """V1DLPPolicyRequest - a agent_model defined in OpenAPI - - Args: - content_types ([str]): The list of content types that policy should apply to. Cannot be empty. Policy content types could be either of \"Messages\", \"RoomMeta\", \"SignalMeta\". Default is set to [\"Messages\"] if not specified. - dictionary_ids ([str]): List of dictionaries Ids for the policy. - name (str): Unique name of a policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed. - scopes ([str]): List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. - type (str): Type of policy. Possible values \"Block\" or \"Warn\". - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.content_types = content_types - self.dictionary_ids = dictionary_ids - self.name = name - self.scopes = scopes - self.type = type - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, content_types, dictionary_ids, name, scopes, type, *args, **kwargs): # noqa: E501 - """V1DLPPolicyRequest - a agent_model defined in OpenAPI - - Args: - content_types ([str]): The list of content types that policy should apply to. Cannot be empty. Policy content types could be either of \"Messages\", \"RoomMeta\", \"SignalMeta\". Default is set to [\"Messages\"] if not specified. - dictionary_ids ([str]): List of dictionaries Ids for the policy. - name (str): Unique name of a policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed. - scopes ([str]): List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. - type (str): Type of policy. Possible values \"Block\" or \"Warn\". - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPPolicyRequest from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "contentTypes": obj.get("contentTypes"), + "dictionaryIds": obj.get("dictionaryIds"), + "name": obj.get("name"), + "scopes": obj.get("scopes"), + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.content_types: List[str] = content_types - self.dictionary_ids: List[str] = dictionary_ids - self.name: str = name - self.scopes: List[str] = scopes - self.type: str = type - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_policy_response.py b/symphony/bdk/gen/agent_model/v1_dlp_policy_response.py index 589c13ec..1815de07 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_policy_response.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_policy_response.py @@ -1,259 +1,91 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_policy import V1DLPPolicy -globals()['V1DLPPolicy'] = V1DLPPolicy +from typing import Optional, Set +from typing_extensions import Self -class V1DLPPolicyResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPPolicyResponse(BaseModel): """ + Policy Response + """ # noqa: E501 + data: Optional[V1DLPPolicy] = None + __properties: ClassVar[List[str]] = ["data"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'data': (V1DLPPolicy, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'data': 'data', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1DLPPolicyResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data (V1DLPPolicy): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPPolicyResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1DLPPolicyResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data (V1DLPPolicy): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPPolicyResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "data": V1DLPPolicy.from_dict(obj["data"]) if obj.get("data") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.data: V1DLPPolicy = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_signal.py b/symphony/bdk/gen/agent_model/v1_dlp_signal.py index 03910863..abd30555 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_signal.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_signal.py @@ -1,271 +1,93 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class V1DLPSignal(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPSignal(BaseModel): """ + Signal details + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the Signal") + name: Optional[StrictStr] = Field(default=None, description="Name of the Signal") + rules: Optional[StrictStr] = Field(default=None, description="Signal rules decrypted.") + diagnostic: Optional[StrictStr] = Field(default=None, description="A diagnostic message containing an error message in the event that the signal decryption failed. May also be present in the case of a successful call if there is useful narrative to return. ") + __properties: ClassVar[List[str]] = ["id", "name", "rules", "diagnostic"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPSignal from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (str, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'rules': (str, none_type), # noqa: E501 - 'diagnostic': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - 'rules': 'rules', # noqa: E501 - 'diagnostic': 'diagnostic', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1DLPSignal - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Unique ID of the Signal. [optional] # noqa: E501 - name (str): Name of the Signal. [optional] # noqa: E501 - rules (str): Signal rules decrypted.. [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the signal decryption failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1DLPSignal - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Unique ID of the Signal. [optional] # noqa: E501 - name (str): Name of the Signal. [optional] # noqa: E501 - rules (str): Signal rules decrypted.. [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the signal decryption failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPSignal from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "rules": obj.get("rules"), + "diagnostic": obj.get("diagnostic") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.name: str = None - self.rules: str = None - self.diagnostic: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_stream.py b/symphony/bdk/gen/agent_model/v1_dlp_stream.py index 83962b86..69ff46eb 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_stream.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_stream.py @@ -1,356 +1,127 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V1DLPStream(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str, none_type), # noqa: E501 - 'creator_pretty_name': (str, none_type), # noqa: E501 - 'public_room': (bool, none_type), # noqa: E501 - 'cross_pod': (bool, none_type), # noqa: E501 - 'allow_external': (bool, none_type), # noqa: E501 - 'creator_id': (str, none_type), # noqa: E501 - 'room_description': (str, none_type), # noqa: E501 - 'stream_id': (str, none_type), # noqa: E501 - 'state': (str, none_type), # noqa: E501 - 'type': (str, none_type), # noqa: E501 - 'last_disabled': (int, none_type), # noqa: E501 - 'member_add_user_enabled': (bool, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'discoverable': (bool, none_type), # noqa: E501 - 'read_only': (bool, none_type), # noqa: E501 - 'copy_disabled': (bool, none_type), # noqa: E501 - 'external_owned': (bool, none_type), # noqa: E501 - 'send_message_disabled': (bool, none_type), # noqa: E501 - 'moderated': (bool, none_type), # noqa: E501 - 'share_history_enabled': (bool, none_type), # noqa: E501 - 'diagnostic': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'name': 'name', # noqa: E501 - 'creator_pretty_name': 'creatorPrettyName', # noqa: E501 - 'public_room': 'publicRoom', # noqa: E501 - 'cross_pod': 'crossPod', # noqa: E501 - 'allow_external': 'allowExternal', # noqa: E501 - 'creator_id': 'creatorId', # noqa: E501 - 'room_description': 'roomDescription', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'state': 'state', # noqa: E501 - 'type': 'type', # noqa: E501 - 'last_disabled': 'lastDisabled', # noqa: E501 - 'member_add_user_enabled': 'memberAddUserEnabled', # noqa: E501 - 'active': 'active', # noqa: E501 - 'discoverable': 'discoverable', # noqa: E501 - 'read_only': 'readOnly', # noqa: E501 - 'copy_disabled': 'copyDisabled', # noqa: E501 - 'external_owned': 'externalOwned', # noqa: E501 - 'send_message_disabled': 'sendMessageDisabled', # noqa: E501 - 'moderated': 'moderated', # noqa: E501 - 'share_history_enabled': 'shareHistoryEnabled', # noqa: E501 - 'diagnostic': 'diagnostic', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class V1DLPStream(BaseModel): + """ + Room details in the context of violation. + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Name of the Stream/Room.") + creator_pretty_name: Optional[StrictStr] = Field(default=None, description="Name of the creator of the Room.", alias="creatorPrettyName") + public_room: Optional[StrictBool] = Field(default=None, description="Is this a public room?", alias="publicRoom") + cross_pod: Optional[StrictBool] = Field(default=None, description="Is this a cross pod scenario?", alias="crossPod") + allow_external: Optional[StrictBool] = Field(default=None, description="Is external messaging allowed", alias="allowExternal") + creator_id: Optional[StrictStr] = Field(default=None, description="Id of the creator of the Room.", alias="creatorId") + room_description: Optional[StrictStr] = Field(default=None, description="Description of the Room.", alias="roomDescription") + stream_id: Optional[StrictStr] = Field(default=None, description="ThreadId of the Room.", alias="streamId") + state: Optional[StrictStr] = Field(default=None, description="State of the Room (example CREATED etc)") + type: Optional[StrictStr] = Field(default=None, description="Type of the Room (example ROOM (or IM or Wall))") + last_disabled: Optional[StrictInt] = Field(default=None, description="Timestamp of last time the room is Disabled", alias="lastDisabled") + member_add_user_enabled: Optional[StrictBool] = Field(default=None, description="Is memberAddUserEnabled", alias="memberAddUserEnabled") + active: Optional[StrictBool] = Field(default=None, description="Is Room Active") + discoverable: Optional[StrictBool] = Field(default=None, description="Is Room discoverable") + read_only: Optional[StrictBool] = Field(default=None, description="Is Room read-only", alias="readOnly") + copy_disabled: Optional[StrictBool] = Field(default=None, description="Is Room copyDisabled", alias="copyDisabled") + external_owned: Optional[StrictBool] = Field(default=None, description="Is Room externalOwned", alias="externalOwned") + send_message_disabled: Optional[StrictBool] = Field(default=None, description="Is sendMessage Disabled for this Room", alias="sendMessageDisabled") + moderated: Optional[StrictBool] = Field(default=None, description="Is room moderated") + share_history_enabled: Optional[StrictBool] = Field(default=None, description="Is room shareHistoryEnabled", alias="shareHistoryEnabled") + diagnostic: Optional[StrictStr] = Field(default=None, description="A diagnostic message containing an error message in the event that the stream retrieval failed. May also be present in the case of a successful call if there is useful narrative to return. ") + __properties: ClassVar[List[str]] = ["name", "creatorPrettyName", "publicRoom", "crossPod", "allowExternal", "creatorId", "roomDescription", "streamId", "state", "type", "lastDisabled", "memberAddUserEnabled", "active", "discoverable", "readOnly", "copyDisabled", "externalOwned", "sendMessageDisabled", "moderated", "shareHistoryEnabled", "diagnostic"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1DLPStream - a agent_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPStream from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Name of the Stream/Room.. [optional] # noqa: E501 - creator_pretty_name (str): Name of the creator of the Room.. [optional] # noqa: E501 - public_room (bool): Is this a public room?. [optional] # noqa: E501 - cross_pod (bool): Is this a cross pod scenario?. [optional] # noqa: E501 - allow_external (bool): Is external messaging allowed. [optional] # noqa: E501 - creator_id (str): Id of the creator of the Room.. [optional] # noqa: E501 - room_description (str): Description of the Room.. [optional] # noqa: E501 - stream_id (str): ThreadId of the Room.. [optional] # noqa: E501 - state (str): State of the Room (example CREATED etc). [optional] # noqa: E501 - type (str): Type of the Room (example ROOM (or IM or Wall)). [optional] # noqa: E501 - last_disabled (int): Timestamp of last time the room is Disabled. [optional] # noqa: E501 - member_add_user_enabled (bool): Is memberAddUserEnabled. [optional] # noqa: E501 - active (bool): Is Room Active. [optional] # noqa: E501 - discoverable (bool): Is Room discoverable. [optional] # noqa: E501 - read_only (bool): Is Room read-only. [optional] # noqa: E501 - copy_disabled (bool): Is Room copyDisabled. [optional] # noqa: E501 - external_owned (bool): Is Room externalOwned. [optional] # noqa: E501 - send_message_disabled (bool): Is sendMessage Disabled for this Room. [optional] # noqa: E501 - moderated (bool): Is room moderated. [optional] # noqa: E501 - share_history_enabled (bool): Is room shareHistoryEnabled. [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the stream retrieval failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1DLPStream - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Name of the Stream/Room.. [optional] # noqa: E501 - creator_pretty_name (str): Name of the creator of the Room.. [optional] # noqa: E501 - public_room (bool): Is this a public room?. [optional] # noqa: E501 - cross_pod (bool): Is this a cross pod scenario?. [optional] # noqa: E501 - allow_external (bool): Is external messaging allowed. [optional] # noqa: E501 - creator_id (str): Id of the creator of the Room.. [optional] # noqa: E501 - room_description (str): Description of the Room.. [optional] # noqa: E501 - stream_id (str): ThreadId of the Room.. [optional] # noqa: E501 - state (str): State of the Room (example CREATED etc). [optional] # noqa: E501 - type (str): Type of the Room (example ROOM (or IM or Wall)). [optional] # noqa: E501 - last_disabled (int): Timestamp of last time the room is Disabled. [optional] # noqa: E501 - member_add_user_enabled (bool): Is memberAddUserEnabled. [optional] # noqa: E501 - active (bool): Is Room Active. [optional] # noqa: E501 - discoverable (bool): Is Room discoverable. [optional] # noqa: E501 - read_only (bool): Is Room read-only. [optional] # noqa: E501 - copy_disabled (bool): Is Room copyDisabled. [optional] # noqa: E501 - external_owned (bool): Is Room externalOwned. [optional] # noqa: E501 - send_message_disabled (bool): Is sendMessage Disabled for this Room. [optional] # noqa: E501 - moderated (bool): Is room moderated. [optional] # noqa: E501 - share_history_enabled (bool): Is room shareHistoryEnabled. [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the stream retrieval failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPStream from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "creatorPrettyName": obj.get("creatorPrettyName"), + "publicRoom": obj.get("publicRoom"), + "crossPod": obj.get("crossPod"), + "allowExternal": obj.get("allowExternal"), + "creatorId": obj.get("creatorId"), + "roomDescription": obj.get("roomDescription"), + "streamId": obj.get("streamId"), + "state": obj.get("state"), + "type": obj.get("type"), + "lastDisabled": obj.get("lastDisabled"), + "memberAddUserEnabled": obj.get("memberAddUserEnabled"), + "active": obj.get("active"), + "discoverable": obj.get("discoverable"), + "readOnly": obj.get("readOnly"), + "copyDisabled": obj.get("copyDisabled"), + "externalOwned": obj.get("externalOwned"), + "sendMessageDisabled": obj.get("sendMessageDisabled"), + "moderated": obj.get("moderated"), + "shareHistoryEnabled": obj.get("shareHistoryEnabled"), + "diagnostic": obj.get("diagnostic") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.creator_pretty_name: str = None - self.public_room: bool = None - self.cross_pod: bool = None - self.allow_external: bool = None - self.creator_id: str = None - self.room_description: str = None - self.stream_id: str = None - self.state: str = None - self.type: str = None - self.last_disabled: int = None - self.member_add_user_enabled: bool = None - self.active: bool = None - self.discoverable: bool = None - self.read_only: bool = None - self.copy_disabled: bool = None - self.external_owned: bool = None - self.send_message_disabled: bool = None - self.moderated: bool = None - self.share_history_enabled: bool = None - self.diagnostic: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_violation.py b/symphony/bdk/gen/agent_model/v1_dlp_violation.py index 323095f8..1b676dec 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_violation.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_violation.py @@ -1,313 +1,123 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_content_type import V1DLPContentType -from symphony.bdk.gen.agent_model.v1_dlp_matched_policy_list import V1DLPMatchedPolicyList +from symphony.bdk.gen.agent_model.v1_dlp_matched_policy import V1DLPMatchedPolicy from symphony.bdk.gen.agent_model.v1_dlp_outcome import V1DLPOutcome -globals()['V1DLPContentType'] = V1DLPContentType -globals()['V1DLPMatchedPolicyList'] = V1DLPMatchedPolicyList -globals()['V1DLPOutcome'] = V1DLPOutcome - -class V1DLPViolation(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPViolation(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'enforcement_event_id': (str, none_type), # noqa: E501 - 'entity_id': (str, none_type), # noqa: E501 - 'create_time': (int, none_type), # noqa: E501 - 'last_modified': (int, none_type), # noqa: E501 - 'requester_id': (int, none_type), # noqa: E501 - 'matched_policies': (V1DLPMatchedPolicyList, none_type), # noqa: E501 - 'action': (str, none_type), # noqa: E501 - 'outcome': (V1DLPOutcome, none_type), # noqa: E501 - 'content_type': (V1DLPContentType, none_type), # noqa: E501 - 'version': (str, none_type), # noqa: E501 - 'ignore_dl_pwarning': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'enforcement_event_id': 'enforcementEventID', # noqa: E501 - 'entity_id': 'entityID', # noqa: E501 - 'create_time': 'createTime', # noqa: E501 - 'last_modified': 'lastModified', # noqa: E501 - 'requester_id': 'requesterId', # noqa: E501 - 'matched_policies': 'matchedPolicies', # noqa: E501 - 'action': 'action', # noqa: E501 - 'outcome': 'outcome', # noqa: E501 - 'content_type': 'contentType', # noqa: E501 - 'version': 'version', # noqa: E501 - 'ignore_dl_pwarning': 'ignoreDLPwarning', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + A representation of a violation due to a message sent by a user of Symphony + """ # noqa: E501 + enforcement_event_id: Optional[StrictStr] = Field(default=None, description="Enforcement event ID. Unique ID that identifies this enforcement.", alias="enforcementEventID") + entity_id: Optional[StrictStr] = Field(default=None, description="Entity ID is the content Id of the violation, for example, for messages, its the Id of the message", alias="entityID") + create_time: Optional[StrictInt] = Field(default=None, description="Timestamp of the violation in milliseconds since Jan 1 1970", alias="createTime") + last_modified: Optional[StrictInt] = Field(default=None, description="Timestamp of the last modification of violation in milliseconds since Jan 1 1970", alias="lastModified") + requester_id: Optional[StrictInt] = Field(default=None, description="Id of the requester responsible for the message/stream/signal", alias="requesterId") + matched_policies: Optional[List[V1DLPMatchedPolicy]] = Field(default=None, description="List of policies that matched the violation.", alias="matchedPolicies") + action: Optional[StrictStr] = Field(default=None, description="action taken such as BLOCK or WARN. See outcome for a more detailed description of the outcome this action.") + outcome: Optional[V1DLPOutcome] = None + content_type: Optional[V1DLPContentType] = Field(default=None, alias="contentType") + version: Optional[StrictStr] = Field(default=None, description="Version of application which processed the message and produced this violation.") + ignore_dl_pwarning: Optional[StrictBool] = Field(default=None, description="Did the user chose to ignore DLP warning that was presented?", alias="ignoreDLPwarning") + __properties: ClassVar[List[str]] = ["enforcementEventID", "entityID", "createTime", "lastModified", "requesterId", "matchedPolicies", "action", "outcome", "contentType", "version", "ignoreDLPwarning"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1DLPViolation - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - enforcement_event_id (str): Enforcement event ID. Unique ID that identifies this enforcement.. [optional] # noqa: E501 - entity_id (str): Entity ID is the content Id of the violation, for example, for messages, its the Id of the message. [optional] # noqa: E501 - create_time (int): Timestamp of the violation in milliseconds since Jan 1 1970. [optional] # noqa: E501 - last_modified (int): Timestamp of the last modification of violation in milliseconds since Jan 1 1970. [optional] # noqa: E501 - requester_id (int): Id of the requester responsible for the message/stream/signal. [optional] # noqa: E501 - matched_policies (V1DLPMatchedPolicyList): [optional] # noqa: E501 - action (str): action taken such as BLOCK or WARN. See outcome for a more detailed description of the outcome this action.. [optional] # noqa: E501 - outcome (V1DLPOutcome): [optional] # noqa: E501 - content_type (V1DLPContentType): [optional] # noqa: E501 - version (str): Version of application which processed the message and produced this violation.. [optional] # noqa: E501 - ignore_dl_pwarning (bool): Did the user chose to ignore DLP warning that was presented?. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPViolation from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1DLPViolation - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - enforcement_event_id (str): Enforcement event ID. Unique ID that identifies this enforcement.. [optional] # noqa: E501 - entity_id (str): Entity ID is the content Id of the violation, for example, for messages, its the Id of the message. [optional] # noqa: E501 - create_time (int): Timestamp of the violation in milliseconds since Jan 1 1970. [optional] # noqa: E501 - last_modified (int): Timestamp of the last modification of violation in milliseconds since Jan 1 1970. [optional] # noqa: E501 - requester_id (int): Id of the requester responsible for the message/stream/signal. [optional] # noqa: E501 - matched_policies (V1DLPMatchedPolicyList): [optional] # noqa: E501 - action (str): action taken such as BLOCK or WARN. See outcome for a more detailed description of the outcome this action.. [optional] # noqa: E501 - outcome (V1DLPOutcome): [optional] # noqa: E501 - content_type (V1DLPContentType): [optional] # noqa: E501 - version (str): Version of application which processed the message and produced this violation.. [optional] # noqa: E501 - ignore_dl_pwarning (bool): Did the user chose to ignore DLP warning that was presented?. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in matched_policies (list) + _items = [] + if self.matched_policies: + for _item_matched_policies in self.matched_policies: + if _item_matched_policies: + _items.append(_item_matched_policies.to_dict()) + _dict['matchedPolicies'] = _items + # override the default output from pydantic by calling `to_dict()` of outcome + if self.outcome: + _dict['outcome'] = self.outcome.to_dict() + # override the default output from pydantic by calling `to_dict()` of content_type + if self.content_type: + _dict['contentType'] = self.content_type.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPViolation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enforcementEventID": obj.get("enforcementEventID"), + "entityID": obj.get("entityID"), + "createTime": obj.get("createTime"), + "lastModified": obj.get("lastModified"), + "requesterId": obj.get("requesterId"), + "matchedPolicies": [V1DLPMatchedPolicy.from_dict(_item) for _item in obj["matchedPolicies"]] if obj.get("matchedPolicies") is not None else None, + "action": obj.get("action"), + "outcome": V1DLPOutcome.from_dict(obj["outcome"]) if obj.get("outcome") is not None else None, + "contentType": V1DLPContentType.from_dict(obj["contentType"]) if obj.get("contentType") is not None else None, + "version": obj.get("version"), + "ignoreDLPwarning": obj.get("ignoreDLPwarning") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.enforcement_event_id: str = None - self.entity_id: str = None - self.create_time: int = None - self.last_modified: int = None - self.requester_id: int = None - self.matched_policies: V1DLPMatchedPolicyList = None - self.action: str = None - self.outcome: V1DLPOutcome = None - self.content_type: V1DLPContentType = None - self.version: str = None - self.ignore_dl_pwarning: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_violation_message.py b/symphony/bdk/gen/agent_model/v1_dlp_violation_message.py index 2c8aae23..72b66baa 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_violation_message.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_violation_message.py @@ -1,271 +1,99 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_violation import V1DLPViolation from symphony.bdk.gen.agent_model.v4_message import V4Message -globals()['V1DLPViolation'] = V1DLPViolation -globals()['V4Message'] = V4Message +from typing import Optional, Set +from typing_extensions import Self -class V1DLPViolationMessage(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPViolationMessage(BaseModel): """ + V1DLPViolationMessage + """ # noqa: E501 + violation: Optional[V1DLPViolation] = None + message: Optional[V4Message] = None + diagnostic: Optional[StrictStr] = Field(default=None, description="A diagnostic message containing an error message in the event there are parsing errors. May also be present in the case of a successful call if there is useful narrative to return. ") + __properties: ClassVar[List[str]] = ["violation", "message", "diagnostic"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'violation': (V1DLPViolation, none_type), # noqa: E501 - 'message': (V4Message, none_type), # noqa: E501 - 'diagnostic': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violation': 'violation', # noqa: E501 - 'message': 'message', # noqa: E501 - 'diagnostic': 'diagnostic', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1DLPViolationMessage - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V1DLPViolation): [optional] # noqa: E501 - message (V4Message): [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event there are parsing errors. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPViolationMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1DLPViolationMessage - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V1DLPViolation): [optional] # noqa: E501 - message (V4Message): [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event there are parsing errors. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of violation + if self.violation: + _dict['violation'] = self.violation.to_dict() + # override the default output from pydantic by calling `to_dict()` of message + if self.message: + _dict['message'] = self.message.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPViolationMessage from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violation": V1DLPViolation.from_dict(obj["violation"]) if obj.get("violation") is not None else None, + "message": V4Message.from_dict(obj["message"]) if obj.get("message") is not None else None, + "diagnostic": obj.get("diagnostic") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violation: V1DLPViolation = None - self.message: V4Message = None - self.diagnostic: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_violation_message_response.py b/symphony/bdk/gen/agent_model/v1_dlp_violation_message_response.py index fe7f6d1a..1c02d6f5 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_violation_message_response.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_violation_message_response.py @@ -1,269 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_violation_message import V1DLPViolationMessage -globals()['V1DLPViolationMessage'] = V1DLPViolationMessage - -class V1DLPViolationMessageResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPViolationMessageResponse(BaseModel): """ + V1DLPViolationMessageResponse + """ # noqa: E501 + violations: List[V1DLPViolationMessage] = Field(description="A representation of list of violations due to messages sent by a user of Symphony") + next_offset: Optional[StrictStr] = Field(default=None, description="Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations.", alias="nextOffset") + __properties: ClassVar[List[str]] = ["violations", "nextOffset"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'violations': ([V1DLPViolationMessage],), # noqa: E501 - 'next_offset': (str, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violations': 'violations', # noqa: E501 - 'next_offset': 'nextOffset', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, violations, *args, **kwargs): # noqa: E501 - """V1DLPViolationMessageResponse - a agent_model defined in OpenAPI - - Args: - violations ([V1DLPViolationMessage]): A representation of list of violations due to messages sent by a user of Symphony - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPViolationMessageResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.violations = violations - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, violations, *args, **kwargs): # noqa: E501 - """V1DLPViolationMessageResponse - a agent_model defined in OpenAPI - - Args: - violations ([V1DLPViolationMessage]): A representation of list of violations due to messages sent by a user of Symphony - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in violations (list) + _items = [] + if self.violations: + for _item_violations in self.violations: + if _item_violations: + _items.append(_item_violations.to_dict()) + _dict['violations'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPViolationMessageResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violations": [V1DLPViolationMessage.from_dict(_item) for _item in obj["violations"]] if obj.get("violations") is not None else None, + "nextOffset": obj.get("nextOffset") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violations: List[V1DLPViolationMessage] = violations - self.next_offset: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_violation_signal.py b/symphony/bdk/gen/agent_model/v1_dlp_violation_signal.py index de326eb8..b8147a08 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_violation_signal.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_violation_signal.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_signal import V1DLPSignal from symphony.bdk.gen.agent_model.v1_dlp_violation import V1DLPViolation -globals()['V1DLPSignal'] = V1DLPSignal -globals()['V1DLPViolation'] = V1DLPViolation +from typing import Optional, Set +from typing_extensions import Self -class V1DLPViolationSignal(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPViolationSignal(BaseModel): """ + V1DLPViolationSignal + """ # noqa: E501 + violation: Optional[V1DLPViolation] = None + signal: Optional[V1DLPSignal] = None + __properties: ClassVar[List[str]] = ["violation", "signal"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'violation': (V1DLPViolation, none_type), # noqa: E501 - 'signal': (V1DLPSignal, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violation': 'violation', # noqa: E501 - 'signal': 'signal', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1DLPViolationSignal - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V1DLPViolation): [optional] # noqa: E501 - signal (V1DLPSignal): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPViolationSignal from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1DLPViolationSignal - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V1DLPViolation): [optional] # noqa: E501 - signal (V1DLPSignal): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of violation + if self.violation: + _dict['violation'] = self.violation.to_dict() + # override the default output from pydantic by calling `to_dict()` of signal + if self.signal: + _dict['signal'] = self.signal.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPViolationSignal from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violation": V1DLPViolation.from_dict(obj["violation"]) if obj.get("violation") is not None else None, + "signal": V1DLPSignal.from_dict(obj["signal"]) if obj.get("signal") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violation: V1DLPViolation = None - self.signal: V1DLPSignal = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_violation_signal_response.py b/symphony/bdk/gen/agent_model/v1_dlp_violation_signal_response.py index 0fe7ea3d..f5ebc76a 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_violation_signal_response.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_violation_signal_response.py @@ -1,269 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_violation_signal import V1DLPViolationSignal -globals()['V1DLPViolationSignal'] = V1DLPViolationSignal - -class V1DLPViolationSignalResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPViolationSignalResponse(BaseModel): """ + V1DLPViolationSignalResponse + """ # noqa: E501 + violations: List[V1DLPViolationSignal] = Field(description="A representation of list of violations due to signal creation/update sent by a user of Symphony") + next_offset: Optional[StrictStr] = Field(default=None, description="Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations.", alias="nextOffset") + __properties: ClassVar[List[str]] = ["violations", "nextOffset"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'violations': ([V1DLPViolationSignal],), # noqa: E501 - 'next_offset': (str, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violations': 'violations', # noqa: E501 - 'next_offset': 'nextOffset', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, violations, *args, **kwargs): # noqa: E501 - """V1DLPViolationSignalResponse - a agent_model defined in OpenAPI - - Args: - violations ([V1DLPViolationSignal]): A representation of list of violations due to signal creation/update sent by a user of Symphony - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPViolationSignalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.violations = violations - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, violations, *args, **kwargs): # noqa: E501 - """V1DLPViolationSignalResponse - a agent_model defined in OpenAPI - - Args: - violations ([V1DLPViolationSignal]): A representation of list of violations due to signal creation/update sent by a user of Symphony - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in violations (list) + _items = [] + if self.violations: + for _item_violations in self.violations: + if _item_violations: + _items.append(_item_violations.to_dict()) + _dict['violations'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPViolationSignalResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violations": [V1DLPViolationSignal.from_dict(_item) for _item in obj["violations"]] if obj.get("violations") is not None else None, + "nextOffset": obj.get("nextOffset") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violations: List[V1DLPViolationSignal] = violations - self.next_offset: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_violation_stream.py b/symphony/bdk/gen/agent_model/v1_dlp_violation_stream.py index de82afe9..3392bd0a 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_violation_stream.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_violation_stream.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_stream import V1DLPStream from symphony.bdk.gen.agent_model.v1_dlp_violation import V1DLPViolation -globals()['V1DLPStream'] = V1DLPStream -globals()['V1DLPViolation'] = V1DLPViolation +from typing import Optional, Set +from typing_extensions import Self -class V1DLPViolationStream(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPViolationStream(BaseModel): """ + V1DLPViolationStream + """ # noqa: E501 + violation: Optional[V1DLPViolation] = None + stream: Optional[V1DLPStream] = None + __properties: ClassVar[List[str]] = ["violation", "stream"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'violation': (V1DLPViolation, none_type), # noqa: E501 - 'stream': (V1DLPStream, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violation': 'violation', # noqa: E501 - 'stream': 'stream', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1DLPViolationStream - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V1DLPViolation): [optional] # noqa: E501 - stream (V1DLPStream): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPViolationStream from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1DLPViolationStream - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V1DLPViolation): [optional] # noqa: E501 - stream (V1DLPStream): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of violation + if self.violation: + _dict['violation'] = self.violation.to_dict() + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPViolationStream from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violation": V1DLPViolation.from_dict(obj["violation"]) if obj.get("violation") is not None else None, + "stream": V1DLPStream.from_dict(obj["stream"]) if obj.get("stream") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violation: V1DLPViolation = None - self.stream: V1DLPStream = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_dlp_violation_stream_response.py b/symphony/bdk/gen/agent_model/v1_dlp_violation_stream_response.py index 0d4c9282..75096412 100644 --- a/symphony/bdk/gen/agent_model/v1_dlp_violation_stream_response.py +++ b/symphony/bdk/gen/agent_model/v1_dlp_violation_stream_response.py @@ -1,269 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_violation_stream import V1DLPViolationStream -globals()['V1DLPViolationStream'] = V1DLPViolationStream - -class V1DLPViolationStreamResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1DLPViolationStreamResponse(BaseModel): """ + V1DLPViolationStreamResponse + """ # noqa: E501 + violations: List[V1DLPViolationStream] + next_offset: Optional[StrictStr] = Field(default=None, description="Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations.", alias="nextOffset") + __properties: ClassVar[List[str]] = ["violations", "nextOffset"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'violations': ([V1DLPViolationStream],), # noqa: E501 - 'next_offset': (str, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violations': 'violations', # noqa: E501 - 'next_offset': 'nextOffset', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, violations, *args, **kwargs): # noqa: E501 - """V1DLPViolationStreamResponse - a agent_model defined in OpenAPI - - Args: - violations ([V1DLPViolationStream]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1DLPViolationStreamResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.violations = violations - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, violations, *args, **kwargs): # noqa: E501 - """V1DLPViolationStreamResponse - a agent_model defined in OpenAPI - - Args: - violations ([V1DLPViolationStream]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in violations (list) + _items = [] + if self.violations: + for _item_violations in self.violations: + if _item_violations: + _items.append(_item_violations.to_dict()) + _dict['violations'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1DLPViolationStreamResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violations": [V1DLPViolationStream.from_dict(_item) for _item in obj["violations"]] if obj.get("violations") is not None else None, + "nextOffset": obj.get("nextOffset") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violations: List[V1DLPViolationStream] = violations - self.next_offset: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v1_health_check_response.py b/symphony/bdk/gen/agent_model/v1_health_check_response.py index dbaf40eb..62d951c5 100644 --- a/symphony/bdk/gen/agent_model/v1_health_check_response.py +++ b/symphony/bdk/gen/agent_model/v1_health_check_response.py @@ -1,276 +1,95 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class V1HealthCheckResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1HealthCheckResponse(BaseModel): """ + V1HealthCheckResponse + """ # noqa: E501 + pod_connectivity: Optional[StrictBool] = Field(default=None, description="Indicates whether the Agent server can connect to the Pod", alias="podConnectivity") + pod_connectivity_error: Optional[StrictStr] = Field(default=None, description="Error details in case of no Pod connectivity", alias="podConnectivityError") + key_manager_connectivity: Optional[StrictBool] = Field(default=None, description="Indicates whether the Agent server can connect to the Key Manager", alias="keyManagerConnectivity") + key_manager_connectivity_error: Optional[StrictStr] = Field(default=None, description="Error details in case of no Key Manager connectivity", alias="keyManagerConnectivityError") + version: Optional[StrictStr] = Field(default=None, description="The version number of the Agent server") + __properties: ClassVar[List[str]] = ["podConnectivity", "podConnectivityError", "keyManagerConnectivity", "keyManagerConnectivityError", "version"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1HealthCheckResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'pod_connectivity': (bool, none_type), # noqa: E501 - 'pod_connectivity_error': (str, none_type), # noqa: E501 - 'key_manager_connectivity': (bool, none_type), # noqa: E501 - 'key_manager_connectivity_error': (str, none_type), # noqa: E501 - 'version': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'pod_connectivity': 'podConnectivity', # noqa: E501 - 'pod_connectivity_error': 'podConnectivityError', # noqa: E501 - 'key_manager_connectivity': 'keyManagerConnectivity', # noqa: E501 - 'key_manager_connectivity_error': 'keyManagerConnectivityError', # noqa: E501 - 'version': 'version', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1HealthCheckResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pod_connectivity (bool): Indicates whether the Agent server can connect to the Pod. [optional] # noqa: E501 - pod_connectivity_error (str): Error details in case of no Pod connectivity. [optional] # noqa: E501 - key_manager_connectivity (bool): Indicates whether the Agent server can connect to the Key Manager. [optional] # noqa: E501 - key_manager_connectivity_error (str): Error details in case of no Key Manager connectivity. [optional] # noqa: E501 - version (str): The version number of the Agent server. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1HealthCheckResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pod_connectivity (bool): Indicates whether the Agent server can connect to the Pod. [optional] # noqa: E501 - pod_connectivity_error (str): Error details in case of no Pod connectivity. [optional] # noqa: E501 - key_manager_connectivity (bool): Indicates whether the Agent server can connect to the Key Manager. [optional] # noqa: E501 - key_manager_connectivity_error (str): Error details in case of no Key Manager connectivity. [optional] # noqa: E501 - version (str): The version number of the Agent server. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1HealthCheckResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "podConnectivity": obj.get("podConnectivity"), + "podConnectivityError": obj.get("podConnectivityError"), + "keyManagerConnectivity": obj.get("keyManagerConnectivity"), + "keyManagerConnectivityError": obj.get("keyManagerConnectivityError"), + "version": obj.get("version") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.pod_connectivity: bool = None - self.pod_connectivity_error: str = None - self.key_manager_connectivity: bool = None - self.key_manager_connectivity_error: str = None - self.version: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v2_base_message.py b/symphony/bdk/gen/agent_model/v2_base_message.py index 29e5a1d0..f5d0bee1 100644 --- a/symphony/bdk/gen/agent_model/v2_base_message.py +++ b/symphony/bdk/gen/agent_model/v2_base_message.py @@ -1,311 +1,137 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 +# coding: utf-8 - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2BaseMessage(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - validations = { +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from importlib import import_module +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +from typing import TYPE_CHECKING +if TYPE_CHECKING: + from symphony.bdk.gen.agent_model.connection_request_message import ConnectionRequestMessage + from symphony.bdk.gen.agent_model.room_created_message import RoomCreatedMessage + from symphony.bdk.gen.agent_model.room_deactivated_message import RoomDeactivatedMessage + from symphony.bdk.gen.agent_model.room_member_demoted_from_owner_message import RoomMemberDemotedFromOwnerMessage + from symphony.bdk.gen.agent_model.room_member_promoted_to_owner_message import RoomMemberPromotedToOwnerMessage + from symphony.bdk.gen.agent_model.room_reactivated_message import RoomReactivatedMessage + from symphony.bdk.gen.agent_model.room_updated_message import RoomUpdatedMessage + from symphony.bdk.gen.agent_model.user_joined_room_message import UserJoinedRoomMessage + from symphony.bdk.gen.agent_model.user_left_room_message import UserLeftRoomMessage + from symphony.bdk.gen.agent_model.v2_message import V2Message + +class V2BaseMessage(BaseModel): + """ + V2BaseMessage + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The messageId is assigned by the ingestor service when a message is sent.") + timestamp: StrictStr + v2message_type: StrictStr = Field(alias="v2messageType") + stream_id: StrictStr = Field(alias="streamId") + __properties: ClassVar[List[str]] = ["id", "timestamp", "v2messageType", "streamId"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + # JSON field name that stores the object type + __discriminator_property_name: ClassVar[str] = 'v2messageType' + + # discriminator mappings + __discriminator_value_class_map: ClassVar[Dict[str, str]] = { + 'ConnectionRequestMessage': 'ConnectionRequestMessage','RoomCreatedMessage': 'RoomCreatedMessage','RoomDeactivatedMessage': 'RoomDeactivatedMessage','RoomMemberDemotedFromOwnerMessage': 'RoomMemberDemotedFromOwnerMessage','RoomMemberPromotedToOwnerMessage': 'RoomMemberPromotedToOwnerMessage','RoomReactivatedMessage': 'RoomReactivatedMessage','RoomUpdatedMessage': 'RoomUpdatedMessage','UserJoinedRoomMessage': 'UserJoinedRoomMessage','UserLeftRoomMessage': 'UserLeftRoomMessage','V2Message': 'V2Message' } - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'timestamp': (str,), # noqa: E501 - 'v2message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - from symphony.bdk.gen.agent_model.connection_request_message import ConnectionRequestMessage - from symphony.bdk.gen.agent_model.room_created_message import RoomCreatedMessage - from symphony.bdk.gen.agent_model.room_deactivated_message import RoomDeactivatedMessage - from symphony.bdk.gen.agent_model.room_member_demoted_from_owner_message import RoomMemberDemotedFromOwnerMessage - from symphony.bdk.gen.agent_model.room_member_promoted_to_owner_message import RoomMemberPromotedToOwnerMessage - from symphony.bdk.gen.agent_model.room_reactivated_message import RoomReactivatedMessage - from symphony.bdk.gen.agent_model.room_updated_message import RoomUpdatedMessage - from symphony.bdk.gen.agent_model.user_joined_room_message import UserJoinedRoomMessage - from symphony.bdk.gen.agent_model.user_left_room_message import UserLeftRoomMessage - from symphony.bdk.gen.agent_model.v2_message import V2Message - globals()['ConnectionRequestMessage'] = ConnectionRequestMessage - globals()['RoomCreatedMessage'] = RoomCreatedMessage - globals()['RoomDeactivatedMessage'] = RoomDeactivatedMessage - globals()['RoomMemberDemotedFromOwnerMessage'] = RoomMemberDemotedFromOwnerMessage - globals()['RoomMemberPromotedToOwnerMessage'] = RoomMemberPromotedToOwnerMessage - globals()['RoomReactivatedMessage'] = RoomReactivatedMessage - globals()['RoomUpdatedMessage'] = RoomUpdatedMessage - globals()['UserJoinedRoomMessage'] = UserJoinedRoomMessage - globals()['UserLeftRoomMessage'] = UserLeftRoomMessage - globals()['V2Message'] = V2Message - val = { - 'ConnectionRequestMessage': ConnectionRequestMessage, - 'RoomCreatedMessage': RoomCreatedMessage, - 'RoomDeactivatedMessage': RoomDeactivatedMessage, - 'RoomMemberDemotedFromOwnerMessage': RoomMemberDemotedFromOwnerMessage, - 'RoomMemberPromotedToOwnerMessage': RoomMemberPromotedToOwnerMessage, - 'RoomReactivatedMessage': RoomReactivatedMessage, - 'RoomUpdatedMessage': RoomUpdatedMessage, - 'UserJoinedRoomMessage': UserJoinedRoomMessage, - 'UserLeftRoomMessage': UserLeftRoomMessage, - 'V2Message': V2Message, - } - if not val: + @classmethod + def get_discriminator_value(cls, obj: Dict[str, Any]) -> Optional[str]: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: return None - return {'v2message_type': val} - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - 'v2message_type': 'v2messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'id': 'id', # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, timestamp, v2message_type, stream_id, *args, **kwargs): # noqa: E501 - """V2BaseMessage - a agent_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Union[ConnectionRequestMessage, RoomCreatedMessage, RoomDeactivatedMessage, RoomMemberDemotedFromOwnerMessage, RoomMemberPromotedToOwnerMessage, RoomReactivatedMessage, RoomUpdatedMessage, UserJoinedRoomMessage, UserLeftRoomMessage, V2Message]]: + """Create an instance of V2BaseMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Args: - timestamp (str): - v2message_type (str): - stream_id (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.timestamp = timestamp - self.v2message_type = v2message_type - self.stream_id = stream_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, timestamp, v2message_type, stream_id, *args, **kwargs): # noqa: E501 - """V2BaseMessage - a agent_model defined in OpenAPI - - Args: - timestamp (str): - v2message_type (str): - stream_id (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Dict[str, Any]) -> Optional[Union[ConnectionRequestMessage, RoomCreatedMessage, RoomDeactivatedMessage, RoomMemberDemotedFromOwnerMessage, RoomMemberPromotedToOwnerMessage, RoomReactivatedMessage, RoomUpdatedMessage, UserJoinedRoomMessage, UserLeftRoomMessage, V2Message]]: + """Create an instance of V2BaseMessage from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type == 'ConnectionRequestMessage': + return import_module("symphony.bdk.gen.agent_model.connection_request_message").ConnectionRequestMessage.from_dict(obj) + if object_type == 'RoomCreatedMessage': + return import_module("symphony.bdk.gen.agent_model.room_created_message").RoomCreatedMessage.from_dict(obj) + if object_type == 'RoomDeactivatedMessage': + return import_module("symphony.bdk.gen.agent_model.room_deactivated_message").RoomDeactivatedMessage.from_dict(obj) + if object_type == 'RoomMemberDemotedFromOwnerMessage': + return import_module("symphony.bdk.gen.agent_model.room_member_demoted_from_owner_message").RoomMemberDemotedFromOwnerMessage.from_dict(obj) + if object_type == 'RoomMemberPromotedToOwnerMessage': + return import_module("symphony.bdk.gen.agent_model.room_member_promoted_to_owner_message").RoomMemberPromotedToOwnerMessage.from_dict(obj) + if object_type == 'RoomReactivatedMessage': + return import_module("symphony.bdk.gen.agent_model.room_reactivated_message").RoomReactivatedMessage.from_dict(obj) + if object_type == 'RoomUpdatedMessage': + return import_module("symphony.bdk.gen.agent_model.room_updated_message").RoomUpdatedMessage.from_dict(obj) + if object_type == 'UserJoinedRoomMessage': + return import_module("symphony.bdk.gen.agent_model.user_joined_room_message").UserJoinedRoomMessage.from_dict(obj) + if object_type == 'UserLeftRoomMessage': + return import_module("symphony.bdk.gen.agent_model.user_left_room_message").UserLeftRoomMessage.from_dict(obj) + if object_type == 'V2Message': + return import_module("symphony.bdk.gen.agent_model.v2_message").V2Message.from_dict(obj) + + raise ValueError("V2BaseMessage failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.timestamp: str = timestamp - self.v2message_type: str = v2message_type - self.stream_id: str = stream_id - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v2_error.py b/symphony/bdk/gen/agent_model/v2_error.py index 8a0000f6..38017630 100644 --- a/symphony/bdk/gen/agent_model/v2_error.py +++ b/symphony/bdk/gen/agent_model/v2_error.py @@ -1,272 +1,91 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2Error(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'code': (int,), # noqa: E501 - 'message': (str,), # noqa: E501 - 'details': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V2Error(BaseModel): + """ + V2Error + """ # noqa: E501 + code: StrictInt + message: StrictStr + details: Optional[Dict[str, Any]] = None + __properties: ClassVar[List[str]] = ["code", "message", "details"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'code': 'code', # noqa: E501 - 'message': 'message', # noqa: E501 - 'details': 'details', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, code, message, *args, **kwargs): # noqa: E501 - """V2Error - a agent_model defined in OpenAPI - - Args: - code (int): - message (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - details ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2Error from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.code = code - self.message = message - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, code, message, *args, **kwargs): # noqa: E501 - """V2Error - a agent_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - code (int): - message (str): + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - details ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2Error from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "details": obj.get("details") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.code: int = code - self.message: str = message - self.details: Union[{str: (bool, date, datetime, dict, float, int, list, str, none_type)}] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v2_health_check_response.py b/symphony/bdk/gen/agent_model/v2_health_check_response.py index e0f0f863..e4fbf1a5 100644 --- a/symphony/bdk/gen/agent_model/v2_health_check_response.py +++ b/symphony/bdk/gen/agent_model/v2_health_check_response.py @@ -1,336 +1,119 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2HealthCheckResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'pod_connectivity': (bool, none_type), # noqa: E501 - 'pod_connectivity_error': (str, none_type), # noqa: E501 - 'key_manager_connectivity': (bool, none_type), # noqa: E501 - 'key_manager_connectivity_error': (str, none_type), # noqa: E501 - 'firehose_connectivity': (bool, none_type), # noqa: E501 - 'firehose_connectivity_error': (str, none_type), # noqa: E501 - 'datafeed_connectivity': (bool, none_type), # noqa: E501 - 'datafeed_connectivity_error': (str, none_type), # noqa: E501 - 'datafeed_version': (str, none_type), # noqa: E501 - 'encrypt_decrypt_success': (bool, none_type), # noqa: E501 - 'encrypt_decrypt_error': (str, none_type), # noqa: E501 - 'pod_version': (str, none_type), # noqa: E501 - 'agent_version': (str, none_type), # noqa: E501 - 'agent_service_user': (bool, none_type), # noqa: E501 - 'agent_service_user_error': (str, none_type), # noqa: E501 - 'ce_service_user': (bool, none_type), # noqa: E501 - 'ce_service_user_error': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'pod_connectivity': 'podConnectivity', # noqa: E501 - 'pod_connectivity_error': 'podConnectivityError', # noqa: E501 - 'key_manager_connectivity': 'keyManagerConnectivity', # noqa: E501 - 'key_manager_connectivity_error': 'keyManagerConnectivityError', # noqa: E501 - 'firehose_connectivity': 'firehoseConnectivity', # noqa: E501 - 'firehose_connectivity_error': 'firehoseConnectivityError', # noqa: E501 - 'datafeed_connectivity': 'datafeedConnectivity', # noqa: E501 - 'datafeed_connectivity_error': 'datafeedConnectivityError', # noqa: E501 - 'datafeed_version': 'datafeedVersion', # noqa: E501 - 'encrypt_decrypt_success': 'encryptDecryptSuccess', # noqa: E501 - 'encrypt_decrypt_error': 'encryptDecryptError', # noqa: E501 - 'pod_version': 'podVersion', # noqa: E501 - 'agent_version': 'agentVersion', # noqa: E501 - 'agent_service_user': 'agentServiceUser', # noqa: E501 - 'agent_service_user_error': 'agentServiceUserError', # noqa: E501 - 'ce_service_user': 'ceServiceUser', # noqa: E501 - 'ce_service_user_error': 'ceServiceUserError', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class V2HealthCheckResponse(BaseModel): + """ + V2HealthCheckResponse + """ # noqa: E501 + pod_connectivity: Optional[StrictBool] = Field(default=None, description="Indicates whether the Agent server can connect to the Pod", alias="podConnectivity") + pod_connectivity_error: Optional[StrictStr] = Field(default=None, description="Error details in case of no Pod connectivity", alias="podConnectivityError") + key_manager_connectivity: Optional[StrictBool] = Field(default=None, description="Indicates whether the Agent server can connect to the Key Manager", alias="keyManagerConnectivity") + key_manager_connectivity_error: Optional[StrictStr] = Field(default=None, description="Error details in case of no Key Manager connectivity", alias="keyManagerConnectivityError") + firehose_connectivity: Optional[StrictBool] = Field(default=None, description="Indicates whether the Agent server can connect to Firehose Service", alias="firehoseConnectivity") + firehose_connectivity_error: Optional[StrictStr] = Field(default=None, description="Error details in case of no Firehose connectivity", alias="firehoseConnectivityError") + datafeed_connectivity: Optional[StrictBool] = Field(default=None, description="Indicates whether the Agent server can connect to Datafeed V2 Service", alias="datafeedConnectivity") + datafeed_connectivity_error: Optional[StrictStr] = Field(default=None, description="Error details in case of no Datafeed V2 connectivity", alias="datafeedConnectivityError") + datafeed_version: Optional[StrictStr] = Field(default=None, description="Indicates the Datafeed V2 version", alias="datafeedVersion") + encrypt_decrypt_success: Optional[StrictBool] = Field(default=None, description="Indicates whether the Agent can successfully decrypt and encrypt messages", alias="encryptDecryptSuccess") + encrypt_decrypt_error: Optional[StrictStr] = Field(default=None, description="Error details in case of the encryption or decryption of the message fails", alias="encryptDecryptError") + pod_version: Optional[StrictStr] = Field(default=None, description="The version number of the pod", alias="podVersion") + agent_version: Optional[StrictStr] = Field(default=None, description="The version number of the Agent server", alias="agentVersion") + agent_service_user: Optional[StrictBool] = Field(default=None, description="Indicates whether agent service user is setup correctly.", alias="agentServiceUser") + agent_service_user_error: Optional[StrictStr] = Field(default=None, description="Error details in case agent service user is setup incorrectly.", alias="agentServiceUserError") + ce_service_user: Optional[StrictBool] = Field(default=None, description="Indicates whether CEService user is setup correctly.", alias="ceServiceUser") + ce_service_user_error: Optional[StrictStr] = Field(default=None, description="Error details in case CEService user is setup incorrectly.", alias="ceServiceUserError") + __properties: ClassVar[List[str]] = ["podConnectivity", "podConnectivityError", "keyManagerConnectivity", "keyManagerConnectivityError", "firehoseConnectivity", "firehoseConnectivityError", "datafeedConnectivity", "datafeedConnectivityError", "datafeedVersion", "encryptDecryptSuccess", "encryptDecryptError", "podVersion", "agentVersion", "agentServiceUser", "agentServiceUserError", "ceServiceUser", "ceServiceUserError"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2HealthCheckResponse - a agent_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2HealthCheckResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pod_connectivity (bool): Indicates whether the Agent server can connect to the Pod. [optional] # noqa: E501 - pod_connectivity_error (str): Error details in case of no Pod connectivity. [optional] # noqa: E501 - key_manager_connectivity (bool): Indicates whether the Agent server can connect to the Key Manager. [optional] # noqa: E501 - key_manager_connectivity_error (str): Error details in case of no Key Manager connectivity. [optional] # noqa: E501 - firehose_connectivity (bool): Indicates whether the Agent server can connect to Firehose Service. [optional] # noqa: E501 - firehose_connectivity_error (str): Error details in case of no Firehose connectivity. [optional] # noqa: E501 - datafeed_connectivity (bool): Indicates whether the Agent server can connect to Datafeed V2 Service. [optional] # noqa: E501 - datafeed_connectivity_error (str): Error details in case of no Datafeed V2 connectivity. [optional] # noqa: E501 - datafeed_version (str): Indicates the Datafeed V2 version. [optional] # noqa: E501 - encrypt_decrypt_success (bool): Indicates whether the Agent can successfully decrypt and encrypt messages. [optional] # noqa: E501 - encrypt_decrypt_error (str): Error details in case of the encryption or decryption of the message fails. [optional] # noqa: E501 - pod_version (str): The version number of the pod. [optional] # noqa: E501 - agent_version (str): The version number of the Agent server. [optional] # noqa: E501 - agent_service_user (bool): Indicates whether agent service user is setup correctly.. [optional] # noqa: E501 - agent_service_user_error (str): Error details in case agent service user is setup incorrectly.. [optional] # noqa: E501 - ce_service_user (bool): Indicates whether CEService user is setup correctly.. [optional] # noqa: E501 - ce_service_user_error (str): Error details in case CEService user is setup incorrectly.. [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2HealthCheckResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pod_connectivity (bool): Indicates whether the Agent server can connect to the Pod. [optional] # noqa: E501 - pod_connectivity_error (str): Error details in case of no Pod connectivity. [optional] # noqa: E501 - key_manager_connectivity (bool): Indicates whether the Agent server can connect to the Key Manager. [optional] # noqa: E501 - key_manager_connectivity_error (str): Error details in case of no Key Manager connectivity. [optional] # noqa: E501 - firehose_connectivity (bool): Indicates whether the Agent server can connect to Firehose Service. [optional] # noqa: E501 - firehose_connectivity_error (str): Error details in case of no Firehose connectivity. [optional] # noqa: E501 - datafeed_connectivity (bool): Indicates whether the Agent server can connect to Datafeed V2 Service. [optional] # noqa: E501 - datafeed_connectivity_error (str): Error details in case of no Datafeed V2 connectivity. [optional] # noqa: E501 - datafeed_version (str): Indicates the Datafeed V2 version. [optional] # noqa: E501 - encrypt_decrypt_success (bool): Indicates whether the Agent can successfully decrypt and encrypt messages. [optional] # noqa: E501 - encrypt_decrypt_error (str): Error details in case of the encryption or decryption of the message fails. [optional] # noqa: E501 - pod_version (str): The version number of the pod. [optional] # noqa: E501 - agent_version (str): The version number of the Agent server. [optional] # noqa: E501 - agent_service_user (bool): Indicates whether agent service user is setup correctly.. [optional] # noqa: E501 - agent_service_user_error (str): Error details in case agent service user is setup incorrectly.. [optional] # noqa: E501 - ce_service_user (bool): Indicates whether CEService user is setup correctly.. [optional] # noqa: E501 - ce_service_user_error (str): Error details in case CEService user is setup incorrectly.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2HealthCheckResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "podConnectivity": obj.get("podConnectivity"), + "podConnectivityError": obj.get("podConnectivityError"), + "keyManagerConnectivity": obj.get("keyManagerConnectivity"), + "keyManagerConnectivityError": obj.get("keyManagerConnectivityError"), + "firehoseConnectivity": obj.get("firehoseConnectivity"), + "firehoseConnectivityError": obj.get("firehoseConnectivityError"), + "datafeedConnectivity": obj.get("datafeedConnectivity"), + "datafeedConnectivityError": obj.get("datafeedConnectivityError"), + "datafeedVersion": obj.get("datafeedVersion"), + "encryptDecryptSuccess": obj.get("encryptDecryptSuccess"), + "encryptDecryptError": obj.get("encryptDecryptError"), + "podVersion": obj.get("podVersion"), + "agentVersion": obj.get("agentVersion"), + "agentServiceUser": obj.get("agentServiceUser"), + "agentServiceUserError": obj.get("agentServiceUserError"), + "ceServiceUser": obj.get("ceServiceUser"), + "ceServiceUserError": obj.get("ceServiceUserError") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.pod_connectivity: bool = None - self.pod_connectivity_error: str = None - self.key_manager_connectivity: bool = None - self.key_manager_connectivity_error: str = None - self.firehose_connectivity: bool = None - self.firehose_connectivity_error: str = None - self.datafeed_connectivity: bool = None - self.datafeed_connectivity_error: str = None - self.datafeed_version: str = None - self.encrypt_decrypt_success: bool = None - self.encrypt_decrypt_error: str = None - self.pod_version: str = None - self.agent_version: str = None - self.agent_service_user: bool = None - self.agent_service_user_error: str = None - self.ce_service_user: bool = None - self.ce_service_user_error: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v2_import_response.py b/symphony/bdk/gen/agent_model/v2_import_response.py index 323fc08c..b68c68c8 100644 --- a/symphony/bdk/gen/agent_model/v2_import_response.py +++ b/symphony/bdk/gen/agent_model/v2_import_response.py @@ -1,271 +1,93 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class V2ImportResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2ImportResponse(BaseModel): """ + V2ImportResponse + """ # noqa: E501 + message_id: Optional[StrictStr] = Field(default=None, description="If the message was successfully imported then the message ID in the system of the newly created message. ", alias="messageId") + originating_system_id: Optional[StrictStr] = Field(default=None, description="The ID of the system through which the message was originally sent.", alias="originatingSystemId") + original_message_id: Optional[StrictStr] = Field(default=None, description="The ID of the message in the original system.", alias="originalMessageId") + diagnostic: Optional[StrictStr] = Field(default=None, description="A diagnostic message containing an error message in the event that the message import failed. May also be present in the case of a successful call if there is useful narrative to return. ") + __properties: ClassVar[List[str]] = ["messageId", "originatingSystemId", "originalMessageId", "diagnostic"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2ImportResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'message_id': (str, none_type), # noqa: E501 - 'originating_system_id': (str, none_type), # noqa: E501 - 'original_message_id': (str, none_type), # noqa: E501 - 'diagnostic': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'message_id': 'messageId', # noqa: E501 - 'originating_system_id': 'originatingSystemId', # noqa: E501 - 'original_message_id': 'originalMessageId', # noqa: E501 - 'diagnostic': 'diagnostic', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2ImportResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): If the message was successfully imported then the message ID in the system of the newly created message. . [optional] # noqa: E501 - originating_system_id (str): The ID of the system through which the message was originally sent.. [optional] # noqa: E501 - original_message_id (str): The ID of the message in the original system.. [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the message import failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2ImportResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): If the message was successfully imported then the message ID in the system of the newly created message. . [optional] # noqa: E501 - originating_system_id (str): The ID of the system through which the message was originally sent.. [optional] # noqa: E501 - original_message_id (str): The ID of the message in the original system.. [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the message import failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2ImportResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "messageId": obj.get("messageId"), + "originatingSystemId": obj.get("originatingSystemId"), + "originalMessageId": obj.get("originalMessageId"), + "diagnostic": obj.get("diagnostic") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message_id: str = None - self.originating_system_id: str = None - self.original_message_id: str = None - self.diagnostic: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v2_import_response_list.py b/symphony/bdk/gen/agent_model/v2_import_response_list.py deleted file mode 100644 index 80395f24..00000000 --- a/symphony/bdk/gen/agent_model/v2_import_response_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.v2_import_response import V2ImportResponse -globals()['V2ImportResponse'] = V2ImportResponse - -class V2ImportResponseList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V2ImportResponse],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V2ImportResponseList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2ImportResponse]): # noqa: E501 - - Keyword Args: - value ([V2ImportResponse]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V2ImportResponse] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V2ImportResponseList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2ImportResponse]): # noqa: E501 - - Keyword Args: - value ([V2ImportResponse]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/v2_imported_message.py b/symphony/bdk/gen/agent_model/v2_imported_message.py index 253bdde0..94795381 100644 --- a/symphony/bdk/gen/agent_model/v2_imported_message.py +++ b/symphony/bdk/gen/agent_model/v2_imported_message.py @@ -1,299 +1,109 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 +# coding: utf-8 - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2ImportedMessage(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('format',): { - 'TEXT': "TEXT", - 'MESSAGEML': "MESSAGEML", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str,), # noqa: E501 - 'intended_message_timestamp': (int,), # noqa: E501 - 'intended_message_from_user_id': (int,), # noqa: E501 - 'originating_system_id': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'format': (str, none_type), # noqa: E501 - 'original_message_id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message': 'message', # noqa: E501 - 'intended_message_timestamp': 'intendedMessageTimestamp', # noqa: E501 - 'intended_message_from_user_id': 'intendedMessageFromUserId', # noqa: E501 - 'originating_system_id': 'originatingSystemId', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'format': 'format', # noqa: E501 - 'original_message_id': 'originalMessageId', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class V2ImportedMessage(BaseModel): + """ + A historic message to be imported into the system. The importing user must have the Content Management role. Also, the importing user must be a member of the conversation it is importing into. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. By design, imported messages do not stream to datafeed or firehose endpoints. + """ # noqa: E501 + message: StrictStr = Field(description="Message text in MessageML") + format: Optional[StrictStr] = None + intended_message_timestamp: StrictInt = Field(description="The timestamp representing the time when the message was sent in the original system in milliseconds since Jan 1st 1970. ", alias="intendedMessageTimestamp") + intended_message_from_user_id: StrictInt = Field(description="The long integer userid of the Symphony user who you intend to show sent the message.", alias="intendedMessageFromUserId") + originating_system_id: StrictStr = Field(description="The ID of the system through which the message was originally sent.", alias="originatingSystemId") + original_message_id: Optional[StrictStr] = Field(default=None, description="The ID of the message in the original system.", alias="originalMessageId") + stream_id: StrictStr = Field(alias="streamId") + __properties: ClassVar[List[str]] = ["message", "format", "intendedMessageTimestamp", "intendedMessageFromUserId", "originatingSystemId", "originalMessageId", "streamId"] + + @field_validator('format') + def format_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['TEXT', 'MESSAGEML']): + raise ValueError("must be one of enum values ('TEXT', 'MESSAGEML')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, message, intended_message_timestamp, intended_message_from_user_id, originating_system_id, stream_id, *args, **kwargs): # noqa: E501 - """V2ImportedMessage - a agent_model defined in OpenAPI - - Args: - message (str): Message text in MessageML - intended_message_timestamp (int): The timestamp representing the time when the message was sent in the original system in milliseconds since Jan 1st 1970. - intended_message_from_user_id (int): The long integer userid of the Symphony user who you intend to show sent the message. - originating_system_id (str): The ID of the system through which the message was originally sent. - stream_id (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - original_message_id (str): The ID of the message in the original system.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2ImportedMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self.message = message - self.intended_message_timestamp = intended_message_timestamp - self.intended_message_from_user_id = intended_message_from_user_id - self.originating_system_id = originating_system_id - self.stream_id = stream_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, message, intended_message_timestamp, intended_message_from_user_id, originating_system_id, stream_id, *args, **kwargs): # noqa: E501 - """V2ImportedMessage - a agent_model defined in OpenAPI - - Args: - message (str): Message text in MessageML - intended_message_timestamp (int): The timestamp representing the time when the message was sent in the original system in milliseconds since Jan 1st 1970. - intended_message_from_user_id (int): The long integer userid of the Symphony user who you intend to show sent the message. - originating_system_id (str): The ID of the system through which the message was originally sent. - stream_id (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - original_message_id (str): The ID of the message in the original system.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2ImportedMessage from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message"), + "format": obj.get("format"), + "intendedMessageTimestamp": obj.get("intendedMessageTimestamp"), + "intendedMessageFromUserId": obj.get("intendedMessageFromUserId"), + "originatingSystemId": obj.get("originatingSystemId"), + "originalMessageId": obj.get("originalMessageId"), + "streamId": obj.get("streamId") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message: str = message - self.intended_message_timestamp: int = intended_message_timestamp - self.intended_message_from_user_id: int = intended_message_from_user_id - self.originating_system_id: str = originating_system_id - self.stream_id: str = stream_id - self.format: str = None - self.original_message_id: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v2_message.py b/symphony/bdk/gen/agent_model/v2_message.py index 25e4cf50..6b035bf2 100644 --- a/symphony/bdk/gen/agent_model/v2_message.py +++ b/symphony/bdk/gen/agent_model/v2_message.py @@ -1,345 +1,104 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.attachment_info import AttachmentInfo from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage -from symphony.bdk.gen.agent_model.v2_message_all_of import V2MessageAllOf -globals()['AttachmentInfo'] = AttachmentInfo -globals()['V2BaseMessage'] = V2BaseMessage -globals()['V2MessageAllOf'] = V2MessageAllOf +from typing import Optional, Set +from typing_extensions import Self -class V2Message(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2Message(V2BaseMessage): """ + A representation of a message sent by a user of Symphony. + """ # noqa: E501 + message: StrictStr = Field(description="Message text in MessageML") + from_user_id: StrictInt = Field(description="the Symphony userId of the user who sent the message. This will be populated by the server (and actually ignored if included when sending a message).", alias="fromUserId") + attachments: Optional[List[AttachmentInfo]] = None + __properties: ClassVar[List[str]] = ["id", "timestamp", "v2messageType", "streamId", "message", "fromUserId", "attachments"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str,), # noqa: E501 - 'from_user_id': (int,), # noqa: E501 - 'timestamp': (str,), # noqa: E501 - 'v2message_type': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'attachments': ([AttachmentInfo], none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def discriminator(): - val = { - } - if not val: - return None - return {'v2message_type': val} - attribute_map = { - 'message': 'message', # noqa: E501 - 'from_user_id': 'fromUserId', # noqa: E501 - 'timestamp': 'timestamp', # noqa: E501 - 'v2message_type': 'v2messageType', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'attachments': 'attachments', # noqa: E501 - 'id': 'id', # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - read_only_vars = { - } + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2Message - a agent_model defined in OpenAPI - - Keyword Args: - message (str): Message text in MessageML - from_user_id (int): the Symphony userId of the user who sent the message. This will be populated by the server (and actually ignored if included when sending a message). - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - attachments ([AttachmentInfo]): [optional] if omitted the server will use the default value of [] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2Message from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2Message - a agent_model defined in OpenAPI - - Keyword Args: - message (str): Message text in MessageML - from_user_id (int): the Symphony userId of the user who sent the message. This will be populated by the server (and actually ignored if included when sending a message). - timestamp (str): - v2message_type (str): - stream_id (str): - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - attachments ([AttachmentInfo]): [optional] if omitted the server will use the default value of [] # noqa: E501 - id (str): The messageId is assigned by the ingestor service when a message is sent.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2Message from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "id": obj.get("id"), + "timestamp": obj.get("timestamp"), + "v2messageType": obj.get("v2messageType"), + "streamId": obj.get("streamId"), + "message": obj.get("message"), + "fromUserId": obj.get("fromUserId"), + "attachments": [AttachmentInfo.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.message: str = kwargs['message'] - self.from_user_id: int = kwargs['from_user_id'] - self.timestamp: str = kwargs['timestamp'] - self.v2message_type: str = kwargs['v2message_type'] - self.stream_id: str = kwargs['stream_id'] - self.attachments: List[AttachmentInfo] = [] - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - V2BaseMessage, - V2MessageAllOf, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/agent_model/v2_message_all_of.py b/symphony/bdk/gen/agent_model/v2_message_all_of.py deleted file mode 100644 index 4304b70a..00000000 --- a/symphony/bdk/gen/agent_model/v2_message_all_of.py +++ /dev/null @@ -1,275 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.attachment_info import AttachmentInfo -globals()['AttachmentInfo'] = AttachmentInfo - -class V2MessageAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str,), # noqa: E501 - 'from_user_id': (int,), # noqa: E501 - 'attachments': ([AttachmentInfo], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message': 'message', # noqa: E501 - 'from_user_id': 'fromUserId', # noqa: E501 - 'attachments': 'attachments', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, message, from_user_id, *args, **kwargs): # noqa: E501 - """V2MessageAllOf - a agent_model defined in OpenAPI - - Args: - message (str): Message text in MessageML - from_user_id (int): the Symphony userId of the user who sent the message. This will be populated by the server (and actually ignored if included when sending a message). - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - attachments ([AttachmentInfo]): [optional] if omitted the server will use the default value of [] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.message = message - self.from_user_id = from_user_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, message, from_user_id, *args, **kwargs): # noqa: E501 - """V2MessageAllOf - a agent_model defined in OpenAPI - - Args: - message (str): Message text in MessageML - from_user_id (int): the Symphony userId of the user who sent the message. This will be populated by the server (and actually ignored if included when sending a message). - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - attachments ([AttachmentInfo]): [optional] if omitted the server will use the default value of [] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.message: str = message - self.from_user_id: int = from_user_id - self.attachments: List[AttachmentInfo] = [] - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v2_message_import_list.py b/symphony/bdk/gen/agent_model/v2_message_import_list.py deleted file mode 100644 index a3c91875..00000000 --- a/symphony/bdk/gen/agent_model/v2_message_import_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.v2_imported_message import V2ImportedMessage -globals()['V2ImportedMessage'] = V2ImportedMessage - -class V2MessageImportList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V2ImportedMessage],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V2MessageImportList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2ImportedMessage]): An ordered list of historic messages to be imported. A list of import responsees will be returned in the same order. . # noqa: E501 - - Keyword Args: - value ([V2ImportedMessage]): An ordered list of historic messages to be imported. A list of import responsees will be returned in the same order. . # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V2ImportedMessage] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V2MessageImportList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2ImportedMessage]): An ordered list of historic messages to be imported. A list of import responsees will be returned in the same order. . # noqa: E501 - - Keyword Args: - value ([V2ImportedMessage]): An ordered list of historic messages to be imported. A list of import responsees will be returned in the same order. . # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/v2_message_list.py b/symphony/bdk/gen/agent_model/v2_message_list.py deleted file mode 100644 index ba161895..00000000 --- a/symphony/bdk/gen/agent_model/v2_message_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage -globals()['V2BaseMessage'] = V2BaseMessage - -class V2MessageList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V2BaseMessage],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V2MessageList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2BaseMessage]): # noqa: E501 - - Keyword Args: - value ([V2BaseMessage]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V2BaseMessage] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V2MessageList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2BaseMessage]): # noqa: E501 - - Keyword Args: - value ([V2BaseMessage]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/v2_message_submission.py b/symphony/bdk/gen/agent_model/v2_message_submission.py index 81e8f214..cf8beec8 100644 --- a/symphony/bdk/gen/agent_model/v2_message_submission.py +++ b/symphony/bdk/gen/agent_model/v2_message_submission.py @@ -1,273 +1,109 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.attachment_info import AttachmentInfo -globals()['AttachmentInfo'] = AttachmentInfo - -class V2MessageSubmission(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2MessageSubmission(BaseModel): """ + V2MessageSubmission + """ # noqa: E501 + format: Optional[StrictStr] = None + message: Optional[StrictStr] = None + attachments: Optional[List[AttachmentInfo]] = None + __properties: ClassVar[List[str]] = ["format", "message", "attachments"] + + @field_validator('format') + def format_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['TEXT', 'MESSAGEML']): + raise ValueError("must be one of enum values ('TEXT', 'MESSAGEML')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('format',): { - 'TEXT': "TEXT", - 'MESSAGEML': "MESSAGEML", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2MessageSubmission from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'format': (str, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - 'attachments': ([AttachmentInfo], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'format': 'format', # noqa: E501 - 'message': 'message', # noqa: E501 - 'attachments': 'attachments', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2MessageSubmission - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - attachments ([AttachmentInfo]): [optional] if omitted the server will use the default value of [] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2MessageSubmission - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - attachments ([AttachmentInfo]): [optional] if omitted the server will use the default value of [] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2MessageSubmission from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "format": obj.get("format"), + "message": obj.get("message"), + "attachments": [AttachmentInfo.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.format: str = None - self.message: str = None - self.attachments: List[AttachmentInfo] = [] - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_dictionary_meta.py b/symphony/bdk/gen/agent_model/v3_dlp_dictionary_meta.py index 17647c2c..74466f97 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_dictionary_meta.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_dictionary_meta.py @@ -1,273 +1,91 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V3DLPDictionaryMeta(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'dict_id': (str,), # noqa: E501 - 'version': (str,), # noqa: E501 - 'name': (str,), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V3DLPDictionaryMeta(BaseModel): + """ + Identity of a dictionary. + """ # noqa: E501 + dict_id: StrictStr = Field(alias="dictId") + version: StrictStr + name: StrictStr + __properties: ClassVar[List[str]] = ["dictId", "version", "name"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'dict_id': 'dictId', # noqa: E501 - 'version': 'version', # noqa: E501 - 'name': 'name', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, dict_id, version, name, *args, **kwargs): # noqa: E501 - """V3DLPDictionaryMeta - a agent_model defined in OpenAPI - - Args: - dict_id (str): - version (str): - name (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPDictionaryMeta from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.dict_id = dict_id - self.version = version - self.name = name - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, dict_id, version, name, *args, **kwargs): # noqa: E501 - """V3DLPDictionaryMeta - a agent_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - dict_id (str): - version (str): - name (str): + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPDictionaryMeta from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "dictId": obj.get("dictId"), + "version": obj.get("version"), + "name": obj.get("name") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.dict_id: str = dict_id - self.version: str = version - self.name: str = name - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_file_classifier_config.py b/symphony/bdk/gen/agent_model/v3_dlp_file_classifier_config.py index 2866ac12..5567459a 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_file_classifier_config.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_file_classifier_config.py @@ -1,267 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V3DLPFileClassifierConfig(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'classifiers': ({str: (str,)},), # noqa: E501 - 'applicable_file_types': ([str],), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V3DLPFileClassifierConfig(BaseModel): + """ + V3DLPFileClassifierConfig + """ # noqa: E501 + classifiers: Dict[str, StrictStr] = Field(description="Classifier is defined as a Key and its Value: e.g.: \"classification\": \"Internal\". Name and value can contain UTF-8 characters. Neither the name nor value cannot be left empty. Maximum 30 characters for the name and value, case insensitive. If files contains k-v pairs in the classifers map, it means a match. Maximum 30 classifiers per policy. ") + applicable_file_types: List[StrictStr] = Field(description="File types that can be applied. Can be [\"PDF\", \"WORD\", \"EXCEL\", \"POWERPOINT\", \"ZIP\", \"CSV\", \"TXT\"].", alias="applicableFileTypes") + __properties: ClassVar[List[str]] = ["classifiers", "applicableFileTypes"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'classifiers': 'classifiers', # noqa: E501 - 'applicable_file_types': 'applicableFileTypes', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, classifiers, applicable_file_types, *args, **kwargs): # noqa: E501 - """V3DLPFileClassifierConfig - a agent_model defined in OpenAPI - - Args: - classifiers ({str: (str,)}): Classifier is defined as a Key and its Value: e.g.: \"classification\": \"Internal\". Name and value can contain UTF-8 characters. Neither the name nor value cannot be left empty. Maximum 30 characters for the name and value, case insensitive. If files contains k-v pairs in the classifers map, it means a match. Maximum 30 classifiers per policy. - applicable_file_types ([str]): File types that can be applied. Can be [\"PDF\", \"WORD\", \"EXCEL\", \"POWERPOINT\", \"ZIP\", \"CSV\", \"TXT\"]. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPFileClassifierConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.classifiers = classifiers - self.applicable_file_types = applicable_file_types - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, classifiers, applicable_file_types, *args, **kwargs): # noqa: E501 - """V3DLPFileClassifierConfig - a agent_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - classifiers ({str: (str,)}): Classifier is defined as a Key and its Value: e.g.: \"classification\": \"Internal\". Name and value can contain UTF-8 characters. Neither the name nor value cannot be left empty. Maximum 30 characters for the name and value, case insensitive. If files contains k-v pairs in the classifers map, it means a match. Maximum 30 classifiers per policy. - applicable_file_types ([str]): File types that can be applied. Can be [\"PDF\", \"WORD\", \"EXCEL\", \"POWERPOINT\", \"ZIP\", \"CSV\", \"TXT\"]. + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPFileClassifierConfig from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "classifiers": obj.get("classifiers"), + "applicableFileTypes": obj.get("applicableFileTypes") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.classifiers: Union[{str: (str,)}] = classifiers - self.applicable_file_types: List[str] = applicable_file_types - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_file_extension_config.py b/symphony/bdk/gen/agent_model/v3_dlp_file_extension_config.py index a52d6f39..69f0d845 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_file_extension_config.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_file_extension_config.py @@ -1,267 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V3DLPFileExtensionConfig(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'allow_lists': ([str],), # noqa: E501 - 'block_lists': ([str],), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V3DLPFileExtensionConfig(BaseModel): + """ + Extension detection config for allowed and blocked types of file extensions. + """ # noqa: E501 + allow_lists: List[StrictStr] = Field(description="File extensions that are allowed.", alias="allowLists") + block_lists: List[StrictStr] = Field(description="File extensions that are blocked.", alias="blockLists") + __properties: ClassVar[List[str]] = ["allowLists", "blockLists"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'allow_lists': 'allowLists', # noqa: E501 - 'block_lists': 'blockLists', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, allow_lists, block_lists, *args, **kwargs): # noqa: E501 - """V3DLPFileExtensionConfig - a agent_model defined in OpenAPI - - Args: - allow_lists ([str]): File extensions that are allowed. - block_lists ([str]): File extensions that are blocked. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPFileExtensionConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.allow_lists = allow_lists - self.block_lists = block_lists - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, allow_lists, block_lists, *args, **kwargs): # noqa: E501 - """V3DLPFileExtensionConfig - a agent_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - allow_lists ([str]): File extensions that are allowed. - block_lists ([str]): File extensions that are blocked. + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPFileExtensionConfig from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "allowLists": obj.get("allowLists"), + "blockLists": obj.get("blockLists") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.allow_lists: List[str] = allow_lists - self.block_lists: List[str] = block_lists - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_file_password_config.py b/symphony/bdk/gen/agent_model/v3_dlp_file_password_config.py index a28e8b68..5aa1fb46 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_file_password_config.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_file_password_config.py @@ -1,267 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V3DLPFilePasswordConfig(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'applicable_file_types': ([str],), # noqa: E501 - 'match_criteria': (str,), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V3DLPFilePasswordConfig(BaseModel): + """ + Password protected detection config for files that are password protected or not. + """ # noqa: E501 + applicable_file_types: List[StrictStr] = Field(description="File types that can be applied. Can be [\"PDF\", \"WORD\", \"EXCEL\", \"POWERPOINT\", \"ZIP\", \"CSV\", \"TXT\"].", alias="applicableFileTypes") + match_criteria: StrictStr = Field(description="Based on the criteria, whether a file is password protected or not means a match. Can be [\"PASSWORD_PROTECTED\", \"NOT_PASSWORD_PROTECTED\"]. The default is \"NOT_PASSWORD_PROTECTED\". ", alias="matchCriteria") + __properties: ClassVar[List[str]] = ["applicableFileTypes", "matchCriteria"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'applicable_file_types': 'applicableFileTypes', # noqa: E501 - 'match_criteria': 'matchCriteria', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, applicable_file_types, match_criteria, *args, **kwargs): # noqa: E501 - """V3DLPFilePasswordConfig - a agent_model defined in OpenAPI - - Args: - applicable_file_types ([str]): File types that can be applied. Can be [\"PDF\", \"WORD\", \"EXCEL\", \"POWERPOINT\", \"ZIP\", \"CSV\", \"TXT\"]. - match_criteria (str): Based on the criteria, whether a file is password protected or not means a match. Can be [\"PASSWORD_PROTECTED\", \"NOT_PASSWORD_PROTECTED\"]. The default is \"NOT_PASSWORD_PROTECTED\". - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPFilePasswordConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.applicable_file_types = applicable_file_types - self.match_criteria = match_criteria - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, applicable_file_types, match_criteria, *args, **kwargs): # noqa: E501 - """V3DLPFilePasswordConfig - a agent_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - applicable_file_types ([str]): File types that can be applied. Can be [\"PDF\", \"WORD\", \"EXCEL\", \"POWERPOINT\", \"ZIP\", \"CSV\", \"TXT\"]. - match_criteria (str): Based on the criteria, whether a file is password protected or not means a match. Can be [\"PASSWORD_PROTECTED\", \"NOT_PASSWORD_PROTECTED\"]. The default is \"NOT_PASSWORD_PROTECTED\". + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPFilePasswordConfig from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "applicableFileTypes": obj.get("applicableFileTypes"), + "matchCriteria": obj.get("matchCriteria") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.applicable_file_types: List[str] = applicable_file_types - self.match_criteria: str = match_criteria - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_file_size_config.py b/symphony/bdk/gen/agent_model/v3_dlp_file_size_config.py index 3fc59980..e51d4b62 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_file_size_config.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_file_size_config.py @@ -1,256 +1,87 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V3DLPFileSizeConfig(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'size_limit': (int, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V3DLPFileSizeConfig(BaseModel): + """ + File size config defines maximum allowed size of file. Default max size limit is 20 MB. + """ # noqa: E501 + size_limit: Optional[StrictInt] = Field(default=None, alias="sizeLimit") + __properties: ClassVar[List[str]] = ["sizeLimit"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'size_limit': 'sizeLimit', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V3DLPFileSizeConfig - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - size_limit (int): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPFileSizeConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V3DLPFileSizeConfig - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - size_limit (int): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPFileSizeConfig from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "sizeLimit": obj.get("sizeLimit") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.size_limit: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_policies_collection_response.py b/symphony/bdk/gen/agent_model/v3_dlp_policies_collection_response.py index 917a9853..5cc26b5c 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_policies_collection_response.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_policies_collection_response.py @@ -1,279 +1,101 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v3_dlp_policy import V3DLPPolicy -globals()['V3DLPPolicy'] = V3DLPPolicy - -class V3DLPPoliciesCollectionResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPPoliciesCollectionResponse(BaseModel): """ + List of policies. + """ # noqa: E501 + policies: List[V3DLPPolicy] = Field(description="List of policies.") + page: Optional[StrictInt] = Field(default=None, description="The starting page for pagination.") + size: Optional[StrictInt] = Field(default=None, description="Size of policies displayed per page.") + page_count: Optional[StrictInt] = Field(default=None, description="Total number of pages available.", alias="pageCount") + __properties: ClassVar[List[str]] = ["policies", "page", "size", "pageCount"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPPoliciesCollectionResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'policies': ([V3DLPPolicy],), # noqa: E501 - 'page': (int, none_type), # noqa: E501 - 'size': (int, none_type), # noqa: E501 - 'page_count': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'policies': 'policies', # noqa: E501 - 'page': 'page', # noqa: E501 - 'size': 'size', # noqa: E501 - 'page_count': 'pageCount', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in policies (list) + _items = [] + if self.policies: + for _item_policies in self.policies: + if _item_policies: + _items.append(_item_policies.to_dict()) + _dict['policies'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, policies, *args, **kwargs): # noqa: E501 - """V3DLPPoliciesCollectionResponse - a agent_model defined in OpenAPI - - Args: - policies ([V3DLPPolicy]): List of policies. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - page (int): The starting page for pagination.. [optional] # noqa: E501 - size (int): Size of policies displayed per page.. [optional] # noqa: E501 - page_count (int): Total number of pages available.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.policies = policies - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, policies, *args, **kwargs): # noqa: E501 - """V3DLPPoliciesCollectionResponse - a agent_model defined in OpenAPI - - Args: - policies ([V3DLPPolicy]): List of policies. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - page (int): The starting page for pagination.. [optional] # noqa: E501 - size (int): Size of policies displayed per page.. [optional] # noqa: E501 - page_count (int): Total number of pages available.. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPPoliciesCollectionResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "policies": [V3DLPPolicy.from_dict(_item) for _item in obj["policies"]] if obj.get("policies") is not None else None, + "page": obj.get("page"), + "size": obj.get("size"), + "pageCount": obj.get("pageCount") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.policies: List[V3DLPPolicy] = policies - self.page: int = None - self.size: int = None - self.page_count: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_policy.py b/symphony/bdk/gen/agent_model/v3_dlp_policy.py index 02105ba2..840d1fb9 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_policy.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_policy.py @@ -1,324 +1,119 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v3_dlp_policy_applies_to import V3DLPPolicyAppliesTo -globals()['V3DLPPolicyAppliesTo'] = V3DLPPolicyAppliesTo - -class V3DLPPolicy(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPPolicy(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'applies_to': ([V3DLPPolicyAppliesTo],), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - 'policy_id': (str, none_type), # noqa: E501 - 'version': (str, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'creator_id': (int, none_type), # noqa: E501 - 'scopes': ([str], none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'deleted': (bool, none_type), # noqa: E501 - 'creation_date': (int, none_type), # noqa: E501 - 'last_updated_date': (int, none_type), # noqa: E501 - 'last_disabled_date': (int, none_type), # noqa: E501 - 'system_policy': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'applies_to': 'appliesTo', # noqa: E501 - 'id': 'id', # noqa: E501 - 'policy_id': 'policyId', # noqa: E501 - 'version': 'version', # noqa: E501 - 'name': 'name', # noqa: E501 - 'creator_id': 'creatorId', # noqa: E501 - 'scopes': 'scopes', # noqa: E501 - 'active': 'active', # noqa: E501 - 'deleted': 'deleted', # noqa: E501 - 'creation_date': 'creationDate', # noqa: E501 - 'last_updated_date': 'lastUpdatedDate', # noqa: E501 - 'last_disabled_date': 'lastDisabledDate', # noqa: E501 - 'system_policy': 'systemPolicy', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + A policy is the main entity of V3 policy/rule system. It is responsible to define rules and add scope constraints to the engine. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique identifier for policy.") + policy_id: Optional[StrictStr] = Field(default=None, description="Policy Id.", alias="policyId") + version: Optional[StrictStr] = Field(default=None, description="The version of the policy, in format \"major.minor\". Initial value will set by backend as \"3.0\" when created. Whenever the policy version needs to be changed, the minor version by 1 unless minor == 999, then the major version is increased by 1 until it reaches 999. ") + name: Optional[StrictStr] = Field(default=None, description="Unique name of policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed. ") + creator_id: Optional[StrictInt] = Field(default=None, description="Numeric userId of the creator.", alias="creatorId") + scopes: Optional[List[StrictStr]] = Field(default=None, description="List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. ") + applies_to: List[V3DLPPolicyAppliesTo] = Field(alias="appliesTo") + active: Optional[StrictBool] = Field(default=None, description="Indicate whether the policy is active or not.") + deleted: Optional[StrictBool] = Field(default=None, description="Indicate whether the policy is deleted or not.") + creation_date: Optional[StrictInt] = Field(default=None, description="Creation time of the policy in milliseconds elapsed as of epoch time.", alias="creationDate") + last_updated_date: Optional[StrictInt] = Field(default=None, description="Recent update time of the policy in milliseconds elapsed as of epoch time.", alias="lastUpdatedDate") + last_disabled_date: Optional[StrictInt] = Field(default=None, description="Recent disable time of the policy in milliseconds elapsed as of epoch time.", alias="lastDisabledDate") + system_policy: Optional[StrictBool] = Field(default=None, alias="systemPolicy") + __properties: ClassVar[List[str]] = ["id", "policyId", "version", "name", "creatorId", "scopes", "appliesTo", "active", "deleted", "creationDate", "lastUpdatedDate", "lastDisabledDate", "systemPolicy"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, applies_to, *args, **kwargs): # noqa: E501 - """V3DLPPolicy - a agent_model defined in OpenAPI - - Args: - applies_to ([V3DLPPolicyAppliesTo]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Unique identifier for policy.. [optional] # noqa: E501 - policy_id (str): Policy Id.. [optional] # noqa: E501 - version (str): The version of the policy, in format \"major.minor\". Initial value will set by backend as \"3.0\" when created. Whenever the policy version needs to be changed, the minor version by 1 unless minor == 999, then the major version is increased by 1 until it reaches 999. . [optional] # noqa: E501 - name (str): Unique name of policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed. . [optional] # noqa: E501 - creator_id (int): Numeric userId of the creator.. [optional] # noqa: E501 - scopes ([str]): List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. . [optional] # noqa: E501 - active (bool): Indicate whether the policy is active or not.. [optional] # noqa: E501 - deleted (bool): Indicate whether the policy is deleted or not.. [optional] # noqa: E501 - creation_date (int): Creation time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - last_updated_date (int): Recent update time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - last_disabled_date (int): Recent disable time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - system_policy (bool): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPPolicy from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.applies_to = applies_to - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, applies_to, *args, **kwargs): # noqa: E501 - """V3DLPPolicy - a agent_model defined in OpenAPI - - Args: - applies_to ([V3DLPPolicyAppliesTo]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Unique identifier for policy.. [optional] # noqa: E501 - policy_id (str): Policy Id.. [optional] # noqa: E501 - version (str): The version of the policy, in format \"major.minor\". Initial value will set by backend as \"3.0\" when created. Whenever the policy version needs to be changed, the minor version by 1 unless minor == 999, then the major version is increased by 1 until it reaches 999. . [optional] # noqa: E501 - name (str): Unique name of policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed. . [optional] # noqa: E501 - creator_id (int): Numeric userId of the creator.. [optional] # noqa: E501 - scopes ([str]): List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. . [optional] # noqa: E501 - active (bool): Indicate whether the policy is active or not.. [optional] # noqa: E501 - deleted (bool): Indicate whether the policy is deleted or not.. [optional] # noqa: E501 - creation_date (int): Creation time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - last_updated_date (int): Recent update time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - last_disabled_date (int): Recent disable time of the policy in milliseconds elapsed as of epoch time.. [optional] # noqa: E501 - system_policy (bool): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in applies_to (list) + _items = [] + if self.applies_to: + for _item_applies_to in self.applies_to: + if _item_applies_to: + _items.append(_item_applies_to.to_dict()) + _dict['appliesTo'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPPolicy from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "policyId": obj.get("policyId"), + "version": obj.get("version"), + "name": obj.get("name"), + "creatorId": obj.get("creatorId"), + "scopes": obj.get("scopes"), + "appliesTo": [V3DLPPolicyAppliesTo.from_dict(_item) for _item in obj["appliesTo"]] if obj.get("appliesTo") is not None else None, + "active": obj.get("active"), + "deleted": obj.get("deleted"), + "creationDate": obj.get("creationDate"), + "lastUpdatedDate": obj.get("lastUpdatedDate"), + "lastDisabledDate": obj.get("lastDisabledDate"), + "systemPolicy": obj.get("systemPolicy") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.applies_to: List[V3DLPPolicyAppliesTo] = applies_to - self.id: str = None - self.policy_id: str = None - self.version: str = None - self.name: str = None - self.creator_id: int = None - self.scopes: List[str] = None - self.active: bool = None - self.deleted: bool = None - self.creation_date: int = None - self.last_updated_date: int = None - self.last_disabled_date: int = None - self.system_policy: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_policy_applies_to.py b/symphony/bdk/gen/agent_model/v3_dlp_policy_applies_to.py index 5850223b..b10db961 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_policy_applies_to.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_policy_applies_to.py @@ -1,276 +1,99 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List from symphony.bdk.gen.agent_model.v3_dlp_rule import V3DLPRule -globals()['V3DLPRule'] = V3DLPRule - -class V3DLPPolicyAppliesTo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPPolicyAppliesTo(BaseModel): """ + V3DLPPolicyAppliesTo + """ # noqa: E501 + data_type: StrictStr = Field(description="The list of data types that policy should apply to. Can't be empty. Can be [\"Messages\",\"RoomMeta\", \"SignalMeta\", \"FileContent\", \"FileMeta\"]. ", alias="dataType") + action: StrictStr = Field(description="Action to be taken on violation detection. Can be [\"Block\", \"Warn\", \"LogOnly\"]. The default is \"LogOnly\". ") + rules: List[V3DLPRule] + __properties: ClassVar[List[str]] = ["dataType", "action", "rules"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'data_type': (str,), # noqa: E501 - 'action': (str,), # noqa: E501 - 'rules': ([V3DLPRule],), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'data_type': 'dataType', # noqa: E501 - 'action': 'action', # noqa: E501 - 'rules': 'rules', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, data_type, action, rules, *args, **kwargs): # noqa: E501 - """V3DLPPolicyAppliesTo - a agent_model defined in OpenAPI - - Args: - data_type (str): The list of data types that policy should apply to. Can't be empty. Can be [\"Messages\",\"RoomMeta\", \"SignalMeta\", \"FileContent\", \"FileMeta\"]. - action (str): Action to be taken on violation detection. Can be [\"Block\", \"Warn\", \"LogOnly\"]. The default is \"LogOnly\". - rules ([V3DLPRule]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPPolicyAppliesTo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.data_type = data_type - self.action = action - self.rules = rules - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, data_type, action, rules, *args, **kwargs): # noqa: E501 - """V3DLPPolicyAppliesTo - a agent_model defined in OpenAPI - - Args: - data_type (str): The list of data types that policy should apply to. Can't be empty. Can be [\"Messages\",\"RoomMeta\", \"SignalMeta\", \"FileContent\", \"FileMeta\"]. - action (str): Action to be taken on violation detection. Can be [\"Block\", \"Warn\", \"LogOnly\"]. The default is \"LogOnly\". - rules ([V3DLPRule]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in rules (list) + _items = [] + if self.rules: + for _item_rules in self.rules: + if _item_rules: + _items.append(_item_rules.to_dict()) + _dict['rules'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPPolicyAppliesTo from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "dataType": obj.get("dataType"), + "action": obj.get("action"), + "rules": [V3DLPRule.from_dict(_item) for _item in obj["rules"]] if obj.get("rules") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.data_type: str = data_type - self.action: str = action - self.rules: List[V3DLPRule] = rules - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_policy_request.py b/symphony/bdk/gen/agent_model/v3_dlp_policy_request.py index 98508673..25bd0615 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_policy_request.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_policy_request.py @@ -1,276 +1,99 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List from symphony.bdk.gen.agent_model.v3_dlp_policy_applies_to import V3DLPPolicyAppliesTo -globals()['V3DLPPolicyAppliesTo'] = V3DLPPolicyAppliesTo - -class V3DLPPolicyRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPPolicyRequest(BaseModel): """ + Request to be used to get policies. + """ # noqa: E501 + name: StrictStr = Field(description="Unique name of a policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed. ") + scopes: List[StrictStr] = Field(description="List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. ") + applies_to: List[V3DLPPolicyAppliesTo] = Field(alias="appliesTo") + __properties: ClassVar[List[str]] = ["name", "scopes", "appliesTo"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str,), # noqa: E501 - 'scopes': ([str],), # noqa: E501 - 'applies_to': ([V3DLPPolicyAppliesTo],), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'name': 'name', # noqa: E501 - 'scopes': 'scopes', # noqa: E501 - 'applies_to': 'appliesTo', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, name, scopes, applies_to, *args, **kwargs): # noqa: E501 - """V3DLPPolicyRequest - a agent_model defined in OpenAPI - - Args: - name (str): Unique name of a policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed. - scopes ([str]): List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. - applies_to ([V3DLPPolicyAppliesTo]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPPolicyRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - self.scopes = scopes - self.applies_to = applies_to - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, name, scopes, applies_to, *args, **kwargs): # noqa: E501 - """V3DLPPolicyRequest - a agent_model defined in OpenAPI - - Args: - name (str): Unique name of a policy, max 30 characters. Cannot be empty. All the leading and trailing blank spaces are trimmed. - scopes ([str]): List of communication scopes. Possible values are \"Internal\" (for Internal conversations) or \"External\" (for External conversations). You can apply both scopes if you set it to [\"Internal\", \"External\"]. - applies_to ([V3DLPPolicyAppliesTo]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in applies_to (list) + _items = [] + if self.applies_to: + for _item_applies_to in self.applies_to: + if _item_applies_to: + _items.append(_item_applies_to.to_dict()) + _dict['appliesTo'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPPolicyRequest from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "scopes": obj.get("scopes"), + "appliesTo": [V3DLPPolicyAppliesTo.from_dict(_item) for _item in obj["appliesTo"]] if obj.get("appliesTo") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = name - self.scopes: List[str] = scopes - self.applies_to: List[V3DLPPolicyAppliesTo] = applies_to - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_policy_response.py b/symphony/bdk/gen/agent_model/v3_dlp_policy_response.py index d2a9a14a..c1bd72ad 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_policy_response.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_policy_response.py @@ -1,259 +1,91 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v3_dlp_policy import V3DLPPolicy -globals()['V3DLPPolicy'] = V3DLPPolicy +from typing import Optional, Set +from typing_extensions import Self -class V3DLPPolicyResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPPolicyResponse(BaseModel): """ + Policy Response. + """ # noqa: E501 + data: Optional[V3DLPPolicy] = None + __properties: ClassVar[List[str]] = ["data"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'data': (V3DLPPolicy, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'data': 'data', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V3DLPPolicyResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data (V3DLPPolicy): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPPolicyResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V3DLPPolicyResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data (V3DLPPolicy): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPPolicyResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "data": V3DLPPolicy.from_dict(obj["data"]) if obj.get("data") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.data: V3DLPPolicy = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_rule.py b/symphony/bdk/gen/agent_model/v3_dlp_rule.py index 9de3ef6f..ef2fab5a 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_rule.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_rule.py @@ -1,308 +1,121 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v3_dlp_file_classifier_config import V3DLPFileClassifierConfig from symphony.bdk.gen.agent_model.v3_dlp_file_extension_config import V3DLPFileExtensionConfig from symphony.bdk.gen.agent_model.v3_dlp_file_password_config import V3DLPFilePasswordConfig from symphony.bdk.gen.agent_model.v3_dlp_file_size_config import V3DLPFileSizeConfig from symphony.bdk.gen.agent_model.v3_dlp_text_match_config import V3DLPTextMatchConfig -globals()['V3DLPFileClassifierConfig'] = V3DLPFileClassifierConfig -globals()['V3DLPFileExtensionConfig'] = V3DLPFileExtensionConfig -globals()['V3DLPFilePasswordConfig'] = V3DLPFilePasswordConfig -globals()['V3DLPFileSizeConfig'] = V3DLPFileSizeConfig -globals()['V3DLPTextMatchConfig'] = V3DLPTextMatchConfig - -class V3DLPRule(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPRule(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str,), # noqa: E501 - 'name': (str,), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - 'text_match_config': (V3DLPTextMatchConfig, none_type), # noqa: E501 - 'file_size_config': (V3DLPFileSizeConfig, none_type), # noqa: E501 - 'file_extension_config': (V3DLPFileExtensionConfig, none_type), # noqa: E501 - 'file_password_config': (V3DLPFilePasswordConfig, none_type), # noqa: E501 - 'file_classifier_config': (V3DLPFileClassifierConfig, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'type': 'type', # noqa: E501 - 'name': 'name', # noqa: E501 - 'id': 'id', # noqa: E501 - 'text_match_config': 'textMatchConfig', # noqa: E501 - 'file_size_config': 'fileSizeConfig', # noqa: E501 - 'file_extension_config': 'fileExtensionConfig', # noqa: E501 - 'file_password_config': 'filePasswordConfig', # noqa: E501 - 'file_classifier_config': 'fileClassifierConfig', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + A Rule defines the actual matching specification for policies. It holds a type and a configuration for the rule, these properties should be used to build the corresponding matching implementation. Only one of the configuration property should be set [textMatchConfig, fileSizeConfig, fileExtensionConfig, filePasswordConfig, fileClassifierConfig]. + """ # noqa: E501 + id: Optional[StrictStr] = None + type: StrictStr = Field(description="Type of a rule used by policy. Can be [\"UNKNOWN\", \"TEXT_MATCH\", \"FILE_EXTENSION\", \"FILE_SIZE\", \"FILE_PASSWORD\", \"FILE_CLASSIFIER\"].") + name: StrictStr = Field(description="Name for rule.") + text_match_config: Optional[V3DLPTextMatchConfig] = Field(default=None, alias="textMatchConfig") + file_size_config: Optional[V3DLPFileSizeConfig] = Field(default=None, alias="fileSizeConfig") + file_extension_config: Optional[V3DLPFileExtensionConfig] = Field(default=None, alias="fileExtensionConfig") + file_password_config: Optional[V3DLPFilePasswordConfig] = Field(default=None, alias="filePasswordConfig") + file_classifier_config: Optional[V3DLPFileClassifierConfig] = Field(default=None, alias="fileClassifierConfig") + __properties: ClassVar[List[str]] = ["id", "type", "name", "textMatchConfig", "fileSizeConfig", "fileExtensionConfig", "filePasswordConfig", "fileClassifierConfig"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, type, name, *args, **kwargs): # noqa: E501 - """V3DLPRule - a agent_model defined in OpenAPI - - Args: - type (str): Type of a rule used by policy. Can be [\"UNKNOWN\", \"TEXT_MATCH\", \"FILE_EXTENSION\", \"FILE_SIZE\", \"FILE_PASSWORD\", \"FILE_CLASSIFIER\"]. - name (str): Name for rule. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - text_match_config (V3DLPTextMatchConfig): [optional] # noqa: E501 - file_size_config (V3DLPFileSizeConfig): [optional] # noqa: E501 - file_extension_config (V3DLPFileExtensionConfig): [optional] # noqa: E501 - file_password_config (V3DLPFilePasswordConfig): [optional] # noqa: E501 - file_classifier_config (V3DLPFileClassifierConfig): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPRule from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.type = type - self.name = name - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, type, name, *args, **kwargs): # noqa: E501 - """V3DLPRule - a agent_model defined in OpenAPI - - Args: - type (str): Type of a rule used by policy. Can be [\"UNKNOWN\", \"TEXT_MATCH\", \"FILE_EXTENSION\", \"FILE_SIZE\", \"FILE_PASSWORD\", \"FILE_CLASSIFIER\"]. - name (str): Name for rule. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - text_match_config (V3DLPTextMatchConfig): [optional] # noqa: E501 - file_size_config (V3DLPFileSizeConfig): [optional] # noqa: E501 - file_extension_config (V3DLPFileExtensionConfig): [optional] # noqa: E501 - file_password_config (V3DLPFilePasswordConfig): [optional] # noqa: E501 - file_classifier_config (V3DLPFileClassifierConfig): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of text_match_config + if self.text_match_config: + _dict['textMatchConfig'] = self.text_match_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of file_size_config + if self.file_size_config: + _dict['fileSizeConfig'] = self.file_size_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of file_extension_config + if self.file_extension_config: + _dict['fileExtensionConfig'] = self.file_extension_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of file_password_config + if self.file_password_config: + _dict['filePasswordConfig'] = self.file_password_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of file_classifier_config + if self.file_classifier_config: + _dict['fileClassifierConfig'] = self.file_classifier_config.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPRule from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "name": obj.get("name"), + "textMatchConfig": V3DLPTextMatchConfig.from_dict(obj["textMatchConfig"]) if obj.get("textMatchConfig") is not None else None, + "fileSizeConfig": V3DLPFileSizeConfig.from_dict(obj["fileSizeConfig"]) if obj.get("fileSizeConfig") is not None else None, + "fileExtensionConfig": V3DLPFileExtensionConfig.from_dict(obj["fileExtensionConfig"]) if obj.get("fileExtensionConfig") is not None else None, + "filePasswordConfig": V3DLPFilePasswordConfig.from_dict(obj["filePasswordConfig"]) if obj.get("filePasswordConfig") is not None else None, + "fileClassifierConfig": V3DLPFileClassifierConfig.from_dict(obj["fileClassifierConfig"]) if obj.get("fileClassifierConfig") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = type - self.name: str = name - self.id: str = None - self.text_match_config: V3DLPTextMatchConfig = None - self.file_size_config: V3DLPFileSizeConfig = None - self.file_extension_config: V3DLPFileExtensionConfig = None - self.file_password_config: V3DLPFilePasswordConfig = None - self.file_classifier_config: V3DLPFileClassifierConfig = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_text_match_config.py b/symphony/bdk/gen/agent_model/v3_dlp_text_match_config.py index 620f5ee4..b9f5dd7f 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_text_match_config.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_text_match_config.py @@ -1,275 +1,99 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v3_dlp_dictionary_meta import V3DLPDictionaryMeta -globals()['V3DLPDictionaryMeta'] = V3DLPDictionaryMeta - -class V3DLPTextMatchConfig(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPTextMatchConfig(BaseModel): """ + This is a configuration that can be used to match text or regex. Configuration that can be used by a rule. This is a configuration that can be used to match text or regex. This configuration also corresponds to V2 TextMatch/RegexMatch of dictionaries. + """ # noqa: E501 + dictionaries: List[V3DLPDictionaryMeta] + count_unique_occurrences: Optional[StrictInt] = Field(default=None, alias="countUniqueOccurrences") + applicable_file_types: List[StrictStr] = Field(description="File types must be applied only for rule type \"FileContent\", otherwise must be empty. Can be [\"PDF\", \"WORD\", \"EXCEL\", \"POWERPOINT\", \"ZIP\", \"CSV\", \"TXT\"]. ", alias="applicableFileTypes") + __properties: ClassVar[List[str]] = ["dictionaries", "countUniqueOccurrences", "applicableFileTypes"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'dictionaries': ([V3DLPDictionaryMeta],), # noqa: E501 - 'applicable_file_types': ([str],), # noqa: E501 - 'count_unique_occurrences': (int, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'dictionaries': 'dictionaries', # noqa: E501 - 'applicable_file_types': 'applicableFileTypes', # noqa: E501 - 'count_unique_occurrences': 'countUniqueOccurrences', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, dictionaries, applicable_file_types, *args, **kwargs): # noqa: E501 - """V3DLPTextMatchConfig - a agent_model defined in OpenAPI - - Args: - dictionaries ([V3DLPDictionaryMeta]): - applicable_file_types ([str]): File types must be applied only for rule type \"FileContent\", otherwise must be empty. Can be [\"PDF\", \"WORD\", \"EXCEL\", \"POWERPOINT\", \"ZIP\", \"CSV\", \"TXT\"]. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count_unique_occurrences (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPTextMatchConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.dictionaries = dictionaries - self.applicable_file_types = applicable_file_types - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, dictionaries, applicable_file_types, *args, **kwargs): # noqa: E501 - """V3DLPTextMatchConfig - a agent_model defined in OpenAPI - - Args: - dictionaries ([V3DLPDictionaryMeta]): - applicable_file_types ([str]): File types must be applied only for rule type \"FileContent\", otherwise must be empty. Can be [\"PDF\", \"WORD\", \"EXCEL\", \"POWERPOINT\", \"ZIP\", \"CSV\", \"TXT\"]. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count_unique_occurrences (int): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in dictionaries (list) + _items = [] + if self.dictionaries: + for _item_dictionaries in self.dictionaries: + if _item_dictionaries: + _items.append(_item_dictionaries.to_dict()) + _dict['dictionaries'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPTextMatchConfig from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "dictionaries": [V3DLPDictionaryMeta.from_dict(_item) for _item in obj["dictionaries"]] if obj.get("dictionaries") is not None else None, + "countUniqueOccurrences": obj.get("countUniqueOccurrences"), + "applicableFileTypes": obj.get("applicableFileTypes") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.dictionaries: List[V3DLPDictionaryMeta] = dictionaries - self.applicable_file_types: List[str] = applicable_file_types - self.count_unique_occurrences: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_violation.py b/symphony/bdk/gen/agent_model/v3_dlp_violation.py index 0a30b8de..ae4a7fc8 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_violation.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_violation.py @@ -1,304 +1,109 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_outcome import V1DLPOutcome -globals()['V1DLPOutcome'] = V1DLPOutcome - -class V3DLPViolation(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPViolation(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'enforcement_event_id': (str, none_type), # noqa: E501 - 'entity_id': (str, none_type), # noqa: E501 - 'create_time': (int, none_type), # noqa: E501 - 'last_modified': (int, none_type), # noqa: E501 - 'requester_id': (int, none_type), # noqa: E501 - 'details': ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}], none_type), # noqa: E501 - 'action': (str, none_type), # noqa: E501 - 'outcome': (V1DLPOutcome, none_type), # noqa: E501 - 'version': (str, none_type), # noqa: E501 - 'ignore_dl_pwarning': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'enforcement_event_id': 'enforcementEventID', # noqa: E501 - 'entity_id': 'entityID', # noqa: E501 - 'create_time': 'createTime', # noqa: E501 - 'last_modified': 'lastModified', # noqa: E501 - 'requester_id': 'requesterId', # noqa: E501 - 'details': 'details', # noqa: E501 - 'action': 'action', # noqa: E501 - 'outcome': 'outcome', # noqa: E501 - 'version': 'version', # noqa: E501 - 'ignore_dl_pwarning': 'ignoreDLPwarning', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + A representation of a violation due to an event created by a user of Symphony + """ # noqa: E501 + enforcement_event_id: Optional[StrictStr] = Field(default=None, description="Enforcement event ID. Unique ID that identifies this enforcement.", alias="enforcementEventID") + entity_id: Optional[StrictStr] = Field(default=None, description="Entity ID is the content Id of the violation. For example, for messages it's the Id of the message", alias="entityID") + create_time: Optional[StrictInt] = Field(default=None, description="Timestamp of the violation in milliseconds since Jan 1 1970", alias="createTime") + last_modified: Optional[StrictInt] = Field(default=None, description="Timestamp of the last modification of violation in milliseconds since Jan 1 1970", alias="lastModified") + requester_id: Optional[StrictInt] = Field(default=None, description="Id of the requester responsible for the message/stream/signal", alias="requesterId") + details: Optional[List[Dict[str, Any]]] = Field(default=None, description="JSON representation of the details of the violation.") + action: Optional[StrictStr] = Field(default=None, description="action taken such as BLOCK or WARN. See outcome for a more detailed description of the outcome this action.") + outcome: Optional[V1DLPOutcome] = None + version: Optional[StrictStr] = Field(default=None, description="Version of application which processed the message and produced this violation.") + ignore_dl_pwarning: Optional[StrictBool] = Field(default=None, description="Did the user chose to ignore DLP warning that was presented?", alias="ignoreDLPwarning") + __properties: ClassVar[List[str]] = ["enforcementEventID", "entityID", "createTime", "lastModified", "requesterId", "details", "action", "outcome", "version", "ignoreDLPwarning"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V3DLPViolation - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - enforcement_event_id (str): Enforcement event ID. Unique ID that identifies this enforcement.. [optional] # noqa: E501 - entity_id (str): Entity ID is the content Id of the violation. For example, for messages it's the Id of the message. [optional] # noqa: E501 - create_time (int): Timestamp of the violation in milliseconds since Jan 1 1970. [optional] # noqa: E501 - last_modified (int): Timestamp of the last modification of violation in milliseconds since Jan 1 1970. [optional] # noqa: E501 - requester_id (int): Id of the requester responsible for the message/stream/signal. [optional] # noqa: E501 - details ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}]): JSON representation of the details of the violation.. [optional] # noqa: E501 - action (str): action taken such as BLOCK or WARN. See outcome for a more detailed description of the outcome this action.. [optional] # noqa: E501 - outcome (V1DLPOutcome): [optional] # noqa: E501 - version (str): Version of application which processed the message and produced this violation.. [optional] # noqa: E501 - ignore_dl_pwarning (bool): Did the user chose to ignore DLP warning that was presented?. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPViolation from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V3DLPViolation - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - enforcement_event_id (str): Enforcement event ID. Unique ID that identifies this enforcement.. [optional] # noqa: E501 - entity_id (str): Entity ID is the content Id of the violation. For example, for messages it's the Id of the message. [optional] # noqa: E501 - create_time (int): Timestamp of the violation in milliseconds since Jan 1 1970. [optional] # noqa: E501 - last_modified (int): Timestamp of the last modification of violation in milliseconds since Jan 1 1970. [optional] # noqa: E501 - requester_id (int): Id of the requester responsible for the message/stream/signal. [optional] # noqa: E501 - details ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}]): JSON representation of the details of the violation.. [optional] # noqa: E501 - action (str): action taken such as BLOCK or WARN. See outcome for a more detailed description of the outcome this action.. [optional] # noqa: E501 - outcome (V1DLPOutcome): [optional] # noqa: E501 - version (str): Version of application which processed the message and produced this violation.. [optional] # noqa: E501 - ignore_dl_pwarning (bool): Did the user chose to ignore DLP warning that was presented?. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of outcome + if self.outcome: + _dict['outcome'] = self.outcome.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPViolation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enforcementEventID": obj.get("enforcementEventID"), + "entityID": obj.get("entityID"), + "createTime": obj.get("createTime"), + "lastModified": obj.get("lastModified"), + "requesterId": obj.get("requesterId"), + "details": obj.get("details"), + "action": obj.get("action"), + "outcome": V1DLPOutcome.from_dict(obj["outcome"]) if obj.get("outcome") is not None else None, + "version": obj.get("version"), + "ignoreDLPwarning": obj.get("ignoreDLPwarning") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.enforcement_event_id: str = None - self.entity_id: str = None - self.create_time: int = None - self.last_modified: int = None - self.requester_id: int = None - self.details: List[{str: (bool, date, datetime, dict, float, int, list, str, none_type)}] = None - self.action: str = None - self.outcome: V1DLPOutcome = None - self.version: str = None - self.ignore_dl_pwarning: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_violation_message.py b/symphony/bdk/gen/agent_model/v3_dlp_violation_message.py index 01bb0e51..ca2c92bc 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_violation_message.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_violation_message.py @@ -1,276 +1,104 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v3_dlp_violation import V3DLPViolation from symphony.bdk.gen.agent_model.v4_message import V4Message -globals()['V3DLPViolation'] = V3DLPViolation -globals()['V4Message'] = V4Message - -class V3DLPViolationMessage(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPViolationMessage(BaseModel): """ + V3DLPViolationMessage + """ # noqa: E501 + violation: Optional[V3DLPViolation] = None + message: Optional[V4Message] = None + shared_message: Optional[V4Message] = Field(default=None, alias="sharedMessage") + diagnostic: Optional[StrictStr] = Field(default=None, description="A diagnostic message containing an error message in the event there are parsing errors. May also be present in the case of a successful call if there is useful narrative to return. ") + __properties: ClassVar[List[str]] = ["violation", "message", "sharedMessage", "diagnostic"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPViolationMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'violation': (V3DLPViolation, none_type), # noqa: E501 - 'message': (V4Message, none_type), # noqa: E501 - 'shared_message': (V4Message, none_type), # noqa: E501 - 'diagnostic': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violation': 'violation', # noqa: E501 - 'message': 'message', # noqa: E501 - 'shared_message': 'sharedMessage', # noqa: E501 - 'diagnostic': 'diagnostic', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of violation + if self.violation: + _dict['violation'] = self.violation.to_dict() + # override the default output from pydantic by calling `to_dict()` of message + if self.message: + _dict['message'] = self.message.to_dict() + # override the default output from pydantic by calling `to_dict()` of shared_message + if self.shared_message: + _dict['sharedMessage'] = self.shared_message.to_dict() + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V3DLPViolationMessage - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V3DLPViolation): [optional] # noqa: E501 - message (V4Message): [optional] # noqa: E501 - shared_message (V4Message): [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event there are parsing errors. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V3DLPViolationMessage - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V3DLPViolation): [optional] # noqa: E501 - message (V4Message): [optional] # noqa: E501 - shared_message (V4Message): [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event there are parsing errors. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPViolationMessage from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violation": V3DLPViolation.from_dict(obj["violation"]) if obj.get("violation") is not None else None, + "message": V4Message.from_dict(obj["message"]) if obj.get("message") is not None else None, + "sharedMessage": V4Message.from_dict(obj["sharedMessage"]) if obj.get("sharedMessage") is not None else None, + "diagnostic": obj.get("diagnostic") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violation: V3DLPViolation = None - self.message: V4Message = None - self.shared_message: V4Message = None - self.diagnostic: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_violation_message_response.py b/symphony/bdk/gen/agent_model/v3_dlp_violation_message_response.py index 9efe017b..c974b487 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_violation_message_response.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_violation_message_response.py @@ -1,269 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v3_dlp_violation_message import V3DLPViolationMessage -globals()['V3DLPViolationMessage'] = V3DLPViolationMessage - -class V3DLPViolationMessageResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPViolationMessageResponse(BaseModel): """ + V3DLPViolationMessageResponse + """ # noqa: E501 + violations: List[V3DLPViolationMessage] = Field(description="A representation of list of violations due to messages sent by a user of Symphony") + next_offset: Optional[StrictStr] = Field(default=None, description="Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations. ", alias="nextOffset") + __properties: ClassVar[List[str]] = ["violations", "nextOffset"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'violations': ([V3DLPViolationMessage],), # noqa: E501 - 'next_offset': (str, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violations': 'violations', # noqa: E501 - 'next_offset': 'nextOffset', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, violations, *args, **kwargs): # noqa: E501 - """V3DLPViolationMessageResponse - a agent_model defined in OpenAPI - - Args: - violations ([V3DLPViolationMessage]): A representation of list of violations due to messages sent by a user of Symphony - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPViolationMessageResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.violations = violations - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, violations, *args, **kwargs): # noqa: E501 - """V3DLPViolationMessageResponse - a agent_model defined in OpenAPI - - Args: - violations ([V3DLPViolationMessage]): A representation of list of violations due to messages sent by a user of Symphony - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations. . [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in violations (list) + _items = [] + if self.violations: + for _item_violations in self.violations: + if _item_violations: + _items.append(_item_violations.to_dict()) + _dict['violations'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPViolationMessageResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violations": [V3DLPViolationMessage.from_dict(_item) for _item in obj["violations"]] if obj.get("violations") is not None else None, + "nextOffset": obj.get("nextOffset") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violations: List[V3DLPViolationMessage] = violations - self.next_offset: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_violation_signal.py b/symphony/bdk/gen/agent_model/v3_dlp_violation_signal.py index 469e1bf1..913cf00d 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_violation_signal.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_violation_signal.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_signal import V1DLPSignal from symphony.bdk.gen.agent_model.v3_dlp_violation import V3DLPViolation -globals()['V1DLPSignal'] = V1DLPSignal -globals()['V3DLPViolation'] = V3DLPViolation +from typing import Optional, Set +from typing_extensions import Self -class V3DLPViolationSignal(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPViolationSignal(BaseModel): """ + V3DLPViolationSignal + """ # noqa: E501 + violation: Optional[V3DLPViolation] = None + signal: Optional[V1DLPSignal] = None + __properties: ClassVar[List[str]] = ["violation", "signal"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'violation': (V3DLPViolation, none_type), # noqa: E501 - 'signal': (V1DLPSignal, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violation': 'violation', # noqa: E501 - 'signal': 'signal', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V3DLPViolationSignal - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V3DLPViolation): [optional] # noqa: E501 - signal (V1DLPSignal): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPViolationSignal from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V3DLPViolationSignal - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V3DLPViolation): [optional] # noqa: E501 - signal (V1DLPSignal): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of violation + if self.violation: + _dict['violation'] = self.violation.to_dict() + # override the default output from pydantic by calling `to_dict()` of signal + if self.signal: + _dict['signal'] = self.signal.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPViolationSignal from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violation": V3DLPViolation.from_dict(obj["violation"]) if obj.get("violation") is not None else None, + "signal": V1DLPSignal.from_dict(obj["signal"]) if obj.get("signal") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violation: V3DLPViolation = None - self.signal: V1DLPSignal = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_violation_signal_response.py b/symphony/bdk/gen/agent_model/v3_dlp_violation_signal_response.py index f27f6012..69fe4736 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_violation_signal_response.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_violation_signal_response.py @@ -1,269 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v3_dlp_violation_signal import V3DLPViolationSignal -globals()['V3DLPViolationSignal'] = V3DLPViolationSignal - -class V3DLPViolationSignalResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPViolationSignalResponse(BaseModel): """ + V3DLPViolationSignalResponse + """ # noqa: E501 + violations: List[V3DLPViolationSignal] = Field(description="A representation of list of violations due to signal creation/update sent by a user of Symphony") + next_offset: Optional[StrictStr] = Field(default=None, description="Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations. ", alias="nextOffset") + __properties: ClassVar[List[str]] = ["violations", "nextOffset"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'violations': ([V3DLPViolationSignal],), # noqa: E501 - 'next_offset': (str, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violations': 'violations', # noqa: E501 - 'next_offset': 'nextOffset', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, violations, *args, **kwargs): # noqa: E501 - """V3DLPViolationSignalResponse - a agent_model defined in OpenAPI - - Args: - violations ([V3DLPViolationSignal]): A representation of list of violations due to signal creation/update sent by a user of Symphony - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPViolationSignalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.violations = violations - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, violations, *args, **kwargs): # noqa: E501 - """V3DLPViolationSignalResponse - a agent_model defined in OpenAPI - - Args: - violations ([V3DLPViolationSignal]): A representation of list of violations due to signal creation/update sent by a user of Symphony - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations. . [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in violations (list) + _items = [] + if self.violations: + for _item_violations in self.violations: + if _item_violations: + _items.append(_item_violations.to_dict()) + _dict['violations'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPViolationSignalResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violations": [V3DLPViolationSignal.from_dict(_item) for _item in obj["violations"]] if obj.get("violations") is not None else None, + "nextOffset": obj.get("nextOffset") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violations: List[V3DLPViolationSignal] = violations - self.next_offset: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_violation_stream.py b/symphony/bdk/gen/agent_model/v3_dlp_violation_stream.py index e8c4ab9a..54cb487b 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_violation_stream.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_violation_stream.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v1_dlp_stream import V1DLPStream from symphony.bdk.gen.agent_model.v3_dlp_violation import V3DLPViolation -globals()['V1DLPStream'] = V1DLPStream -globals()['V3DLPViolation'] = V3DLPViolation +from typing import Optional, Set +from typing_extensions import Self -class V3DLPViolationStream(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPViolationStream(BaseModel): """ + V3DLPViolationStream + """ # noqa: E501 + violation: Optional[V3DLPViolation] = None + stream: Optional[V1DLPStream] = None + __properties: ClassVar[List[str]] = ["violation", "stream"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'violation': (V3DLPViolation, none_type), # noqa: E501 - 'stream': (V1DLPStream, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violation': 'violation', # noqa: E501 - 'stream': 'stream', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V3DLPViolationStream - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V3DLPViolation): [optional] # noqa: E501 - stream (V1DLPStream): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPViolationStream from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V3DLPViolationStream - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - violation (V3DLPViolation): [optional] # noqa: E501 - stream (V1DLPStream): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of violation + if self.violation: + _dict['violation'] = self.violation.to_dict() + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPViolationStream from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violation": V3DLPViolation.from_dict(obj["violation"]) if obj.get("violation") is not None else None, + "stream": V1DLPStream.from_dict(obj["stream"]) if obj.get("stream") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violation: V3DLPViolation = None - self.stream: V1DLPStream = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_dlp_violation_stream_response.py b/symphony/bdk/gen/agent_model/v3_dlp_violation_stream_response.py index 08693820..41492eda 100644 --- a/symphony/bdk/gen/agent_model/v3_dlp_violation_stream_response.py +++ b/symphony/bdk/gen/agent_model/v3_dlp_violation_stream_response.py @@ -1,269 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v3_dlp_violation_stream import V3DLPViolationStream -globals()['V3DLPViolationStream'] = V3DLPViolationStream - -class V3DLPViolationStreamResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3DLPViolationStreamResponse(BaseModel): """ + V3DLPViolationStreamResponse + """ # noqa: E501 + violations: List[V3DLPViolationStream] + next_offset: Optional[StrictStr] = Field(default=None, description="Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations. ", alias="nextOffset") + __properties: ClassVar[List[str]] = ["violations", "nextOffset"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'violations': ([V3DLPViolationStream],), # noqa: E501 - 'next_offset': (str, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'violations': 'violations', # noqa: E501 - 'next_offset': 'nextOffset', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, violations, *args, **kwargs): # noqa: E501 - """V3DLPViolationStreamResponse - a agent_model defined in OpenAPI - - Args: - violations ([V3DLPViolationStream]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3DLPViolationStreamResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.violations = violations - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, violations, *args, **kwargs): # noqa: E501 - """V3DLPViolationStreamResponse - a agent_model defined in OpenAPI - - Args: - violations ([V3DLPViolationStream]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - next_offset (str): Offset for the next chunk of violations to be submitted in the next request. Value is null if there are no further violations. . [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in violations (list) + _items = [] + if self.violations: + for _item_violations in self.violations: + if _item_violations: + _items.append(_item_violations.to_dict()) + _dict['violations'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3DLPViolationStreamResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "violations": [V3DLPViolationStream.from_dict(_item) for _item in obj["violations"]] if obj.get("violations") is not None else None, + "nextOffset": obj.get("nextOffset") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.violations: List[V3DLPViolationStream] = violations - self.next_offset: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_health.py b/symphony/bdk/gen/agent_model/v3_health.py index f3668716..fe33cc66 100644 --- a/symphony/bdk/gen/agent_model/v3_health.py +++ b/symphony/bdk/gen/agent_model/v3_health.py @@ -1,276 +1,119 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v3_health_component import V3HealthComponent from symphony.bdk.gen.agent_model.v3_health_status import V3HealthStatus -globals()['V3HealthComponent'] = V3HealthComponent -globals()['V3HealthStatus'] = V3HealthStatus - -class V3Health(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3Health(BaseModel): """ + V3Health + """ # noqa: E501 + services: Optional[Dict[str, V3HealthComponent]] = None + status: Optional[V3HealthStatus] = None + users: Optional[Dict[str, V3HealthComponent]] = None + version: Optional[StrictStr] = Field(default=None, description="Required Agent verison") + __properties: ClassVar[List[str]] = ["services", "status", "users", "version"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3Health from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'services': ({str: (V3HealthComponent,)}, none_type), # noqa: E501 - 'status': (V3HealthStatus, none_type), # noqa: E501 - 'users': ({str: (V3HealthComponent,)}, none_type), # noqa: E501 - 'version': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'services': 'services', # noqa: E501 - 'status': 'status', # noqa: E501 - 'users': 'users', # noqa: E501 - 'version': 'version', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each value in services (dict) + _field_dict = {} + if self.services: + for _key_services in self.services: + if self.services[_key_services]: + _field_dict[_key_services] = self.services[_key_services].to_dict() + _dict['services'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in users (dict) + _field_dict = {} + if self.users: + for _key_users in self.users: + if self.users[_key_users]: + _field_dict[_key_users] = self.users[_key_users].to_dict() + _dict['users'] = _field_dict + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V3Health - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - services ({str: (V3HealthComponent,)}): [optional] # noqa: E501 - status (V3HealthStatus): [optional] # noqa: E501 - users ({str: (V3HealthComponent,)}): [optional] # noqa: E501 - version (str): Required Agent verison. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3Health from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "services": dict( + (_k, V3HealthComponent.from_dict(_v)) + for _k, _v in obj["services"].items() ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V3Health - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - services ({str: (V3HealthComponent,)}): [optional] # noqa: E501 - status (V3HealthStatus): [optional] # noqa: E501 - users ({str: (V3HealthComponent,)}): [optional] # noqa: E501 - version (str): Required Agent verison. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), + if obj.get("services") is not None + else None, + "status": obj.get("status"), + "users": dict( + (_k, V3HealthComponent.from_dict(_v)) + for _k, _v in obj["users"].items() ) + if obj.get("users") is not None + else None, + "version": obj.get("version") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.services: Union[{str: (V3HealthComponent,)}] = None - self.status: V3HealthStatus = None - self.users: Union[{str: (V3HealthComponent,)}] = None - self.version: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_health_auth_type.py b/symphony/bdk/gen/agent_model/v3_health_auth_type.py index 2004addb..8a6e858c 100644 --- a/symphony/bdk/gen/agent_model/v3_health_auth_type.py +++ b/symphony/bdk/gen/agent_model/v3_health_auth_type.py @@ -1,282 +1,37 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 +# coding: utf-8 - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V3HealthAuthType(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('value',): { - 'RSA': "RSA", - 'CERT': "CERT", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': (str,), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - _composed_schemas = None +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V3HealthAuthType - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Type of authentication., must be one of ["RSA", "CERT", ] # noqa: E501 - - Keyword Args: - value (str): Type of authentication., must be one of ["RSA", "CERT", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) +class V3HealthAuthType(str, Enum): + """ + Type of authentication + """ - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: str = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + """ + allowed enum values + """ + RSA = 'RSA' + CERT = 'CERT' @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V3HealthAuthType - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Type of authentication., must be one of ["RSA", "CERT", ] # noqa: E501 - - Keyword Args: - value (str): Type of authentication., must be one of ["RSA", "CERT", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Self: + """Create an instance of V3HealthAuthType from a JSON string""" + return cls(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - return self diff --git a/symphony/bdk/gen/agent_model/v3_health_component.py b/symphony/bdk/gen/agent_model/v3_health_component.py index 19471a03..ee8d3462 100644 --- a/symphony/bdk/gen/agent_model/v3_health_component.py +++ b/symphony/bdk/gen/agent_model/v3_health_component.py @@ -1,276 +1,95 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v3_health_auth_type import V3HealthAuthType from symphony.bdk.gen.agent_model.v3_health_status import V3HealthStatus -globals()['V3HealthAuthType'] = V3HealthAuthType -globals()['V3HealthStatus'] = V3HealthStatus +from typing import Optional, Set +from typing_extensions import Self -class V3HealthComponent(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3HealthComponent(BaseModel): """ + V3HealthComponent + """ # noqa: E501 + auth_type: Optional[V3HealthAuthType] = Field(default=None, alias="authType") + message: Optional[StrictStr] = Field(default=None, description="An error message, if the component status is DOWN") + status: Optional[V3HealthStatus] = None + version: Optional[StrictStr] = Field(default=None, description="Optional component version") + __properties: ClassVar[List[str]] = ["authType", "message", "status", "version"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3HealthComponent from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'auth_type': (V3HealthAuthType, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - 'status': (V3HealthStatus, none_type), # noqa: E501 - 'version': (str, none_type), # noqa: E501 - } + excluded_fields: Set[str] = set([ + ]) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'auth_type': 'authType', # noqa: E501 - 'message': 'message', # noqa: E501 - 'status': 'status', # noqa: E501 - 'version': 'version', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V3HealthComponent - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - auth_type (V3HealthAuthType): [optional] # noqa: E501 - message (str): An error message, if the component status is DOWN. [optional] # noqa: E501 - status (V3HealthStatus): [optional] # noqa: E501 - version (str): Optional component version. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V3HealthComponent - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - auth_type (V3HealthAuthType): [optional] # noqa: E501 - message (str): An error message, if the component status is DOWN. [optional] # noqa: E501 - status (V3HealthStatus): [optional] # noqa: E501 - version (str): Optional component version. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3HealthComponent from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "authType": obj.get("authType"), + "message": obj.get("message"), + "status": obj.get("status"), + "version": obj.get("version") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.auth_type: V3HealthAuthType = None - self.message: str = None - self.status: V3HealthStatus = None - self.version: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v3_health_status.py b/symphony/bdk/gen/agent_model/v3_health_status.py index 55a69fdc..18ae5981 100644 --- a/symphony/bdk/gen/agent_model/v3_health_status.py +++ b/symphony/bdk/gen/agent_model/v3_health_status.py @@ -1,282 +1,37 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 +# coding: utf-8 - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V3HealthStatus(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('value',): { - 'UP': "UP", - 'DOWN': "DOWN", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': (str,), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - _composed_schemas = None +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V3HealthStatus - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Application health status.., must be one of ["UP", "DOWN", ] # noqa: E501 - - Keyword Args: - value (str): Application health status.., must be one of ["UP", "DOWN", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) +class V3HealthStatus(str, Enum): + """ + Application health status. + """ - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: str = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + """ + allowed enum values + """ + UP = 'UP' + DOWN = 'DOWN' @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V3HealthStatus - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Application health status.., must be one of ["UP", "DOWN", ] # noqa: E501 - - Keyword Args: - value (str): Application health status.., must be one of ["UP", "DOWN", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Self: + """Create an instance of V3HealthStatus from a JSON string""" + return cls(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - return self diff --git a/symphony/bdk/gen/agent_model/v4_attachment_info.py b/symphony/bdk/gen/agent_model/v4_attachment_info.py index 65e16079..e4b7de9a 100644 --- a/symphony/bdk/gen/agent_model/v4_attachment_info.py +++ b/symphony/bdk/gen/agent_model/v4_attachment_info.py @@ -1,282 +1,101 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List from symphony.bdk.gen.agent_model.v4_thumbnail_info import V4ThumbnailInfo -globals()['V4ThumbnailInfo'] = V4ThumbnailInfo - -class V4AttachmentInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4AttachmentInfo(BaseModel): """ + V4AttachmentInfo + """ # noqa: E501 + id: StrictStr = Field(description="The attachment ID.") + name: StrictStr = Field(description="The file name.") + size: StrictInt = Field(description="Size in bytes.") + images: List[V4ThumbnailInfo] + __properties: ClassVar[List[str]] = ["id", "name", "size", "images"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4AttachmentInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (str,), # noqa: E501 - 'name': (str,), # noqa: E501 - 'size': (int,), # noqa: E501 - 'images': ([V4ThumbnailInfo],), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - 'size': 'size', # noqa: E501 - 'images': 'images', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in images (list) + _items = [] + if self.images: + for _item_images in self.images: + if _item_images: + _items.append(_item_images.to_dict()) + _dict['images'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, id, name, size, images, *args, **kwargs): # noqa: E501 - """V4AttachmentInfo - a agent_model defined in OpenAPI - - Args: - id (str): The attachment ID. - name (str): The file name. - size (int): Size in bytes. - images ([V4ThumbnailInfo]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.id = id - self.name = name - self.size = size - self.images = images - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, id, name, size, images, *args, **kwargs): # noqa: E501 - """V4AttachmentInfo - a agent_model defined in OpenAPI - - Args: - id (str): The attachment ID. - name (str): The file name. - size (int): Size in bytes. - images ([V4ThumbnailInfo]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4AttachmentInfo from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "size": obj.get("size"), + "images": [V4ThumbnailInfo.from_dict(_item) for _item in obj["images"]] if obj.get("images") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = id - self.name: str = name - self.size: int = size - self.images: List[V4ThumbnailInfo] = images - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_connection_accepted.py b/symphony/bdk/gen/agent_model/v4_connection_accepted.py index cffdf3be..92c44e7f 100644 --- a/symphony/bdk/gen/agent_model/v4_connection_accepted.py +++ b/symphony/bdk/gen/agent_model/v4_connection_accepted.py @@ -1,259 +1,91 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_user import V4User -globals()['V4User'] = V4User +from typing import Optional, Set +from typing_extensions import Self -class V4ConnectionAccepted(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4ConnectionAccepted(BaseModel): """ + V4ConnectionAccepted + """ # noqa: E501 + from_user: Optional[V4User] = Field(default=None, alias="fromUser") + __properties: ClassVar[List[str]] = ["fromUser"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'from_user': (V4User, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'from_user': 'fromUser', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4ConnectionAccepted - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - from_user (V4User): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4ConnectionAccepted from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4ConnectionAccepted - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - from_user (V4User): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of from_user + if self.from_user: + _dict['fromUser'] = self.from_user.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4ConnectionAccepted from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "fromUser": V4User.from_dict(obj["fromUser"]) if obj.get("fromUser") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.from_user: V4User = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_connection_requested.py b/symphony/bdk/gen/agent_model/v4_connection_requested.py index 2d359d0d..a93cb78f 100644 --- a/symphony/bdk/gen/agent_model/v4_connection_requested.py +++ b/symphony/bdk/gen/agent_model/v4_connection_requested.py @@ -1,259 +1,91 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_user import V4User -globals()['V4User'] = V4User +from typing import Optional, Set +from typing_extensions import Self -class V4ConnectionRequested(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4ConnectionRequested(BaseModel): """ + V4ConnectionRequested + """ # noqa: E501 + to_user: Optional[V4User] = Field(default=None, alias="toUser") + __properties: ClassVar[List[str]] = ["toUser"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'to_user': (V4User, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'to_user': 'toUser', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4ConnectionRequested - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - to_user (V4User): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4ConnectionRequested from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4ConnectionRequested - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - to_user (V4User): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of to_user + if self.to_user: + _dict['toUser'] = self.to_user.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4ConnectionRequested from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "toUser": V4User.from_dict(obj["toUser"]) if obj.get("toUser") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.to_user: V4User = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_event.py b/symphony/bdk/gen/agent_model/v4_event.py index 08921f5e..834e1235 100644 --- a/symphony/bdk/gen/agent_model/v4_event.py +++ b/symphony/bdk/gen/agent_model/v4_event.py @@ -1,291 +1,107 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_initiator import V4Initiator from symphony.bdk.gen.agent_model.v4_payload import V4Payload -globals()['V4Initiator'] = V4Initiator -globals()['V4Payload'] = V4Payload - -class V4Event(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4Event(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'message_id': (str, none_type), # noqa: E501 - 'timestamp': (int, none_type), # noqa: E501 - 'type': (str, none_type), # noqa: E501 - 'diagnostic': (str, none_type), # noqa: E501 - 'initiator': (V4Initiator, none_type), # noqa: E501 - 'payload': (V4Payload, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'message_id': 'messageId', # noqa: E501 - 'timestamp': 'timestamp', # noqa: E501 - 'type': 'type', # noqa: E501 - 'diagnostic': 'diagnostic', # noqa: E501 - 'initiator': 'initiator', # noqa: E501 - 'payload': 'payload', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + V4Event + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Event ID") + message_id: Optional[StrictStr] = Field(default=None, description="Message ID", alias="messageId") + timestamp: Optional[StrictInt] = Field(default=None, description="Timestamp of event") + type: Optional[StrictStr] = Field(default=None, description="Event type, possible events are: - MESSAGESENT - SHAREDPOST - INSTANTMESSAGECREATED - ROOMCREATED - ROOMUPDATED - ROOMDEACTIVATED - ROOMREACTIVATED - USERJOINEDROOM - USERLEFTROOM - ROOMMEMBERPROMOTEDTOOWNER - ROOMMEMBERDEMOTEDFROMOWNER - CONNECTIONREQUESTED - CONNECTIONACCEPTED - MESSAGESUPPRESSED - SYMPHONYELEMENTSACTION - USERREQUESTEDTOJOINROOM - GENERICSYSTEMEVENT ") + diagnostic: Optional[StrictStr] = Field(default=None, description="Details if event failed to parse for any reason. The contents of this field may not be useful, depending on the nature of the error. Only present when error occurs. ") + initiator: Optional[V4Initiator] = None + payload: Optional[V4Payload] = None + __properties: ClassVar[List[str]] = ["id", "messageId", "timestamp", "type", "diagnostic", "initiator", "payload"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4Event - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Event ID. [optional] # noqa: E501 - message_id (str): Message ID. [optional] # noqa: E501 - timestamp (int): Timestamp of event. [optional] # noqa: E501 - type (str): Event type, possible events are: - MESSAGESENT - SHAREDPOST - INSTANTMESSAGECREATED - ROOMCREATED - ROOMUPDATED - ROOMDEACTIVATED - ROOMREACTIVATED - USERJOINEDROOM - USERLEFTROOM - ROOMMEMBERPROMOTEDTOOWNER - ROOMMEMBERDEMOTEDFROMOWNER - CONNECTIONREQUESTED - CONNECTIONACCEPTED - MESSAGESUPPRESSED - SYMPHONYELEMENTSACTION - USERREQUESTEDTOJOINROOM - GENERICSYSTEMEVENT . [optional] # noqa: E501 - diagnostic (str): Details if event failed to parse for any reason. The contents of this field may not be useful, depending on the nature of the error. Only present when error occurs. . [optional] # noqa: E501 - initiator (V4Initiator): [optional] # noqa: E501 - payload (V4Payload): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4Event from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4Event - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Event ID. [optional] # noqa: E501 - message_id (str): Message ID. [optional] # noqa: E501 - timestamp (int): Timestamp of event. [optional] # noqa: E501 - type (str): Event type, possible events are: - MESSAGESENT - SHAREDPOST - INSTANTMESSAGECREATED - ROOMCREATED - ROOMUPDATED - ROOMDEACTIVATED - ROOMREACTIVATED - USERJOINEDROOM - USERLEFTROOM - ROOMMEMBERPROMOTEDTOOWNER - ROOMMEMBERDEMOTEDFROMOWNER - CONNECTIONREQUESTED - CONNECTIONACCEPTED - MESSAGESUPPRESSED - SYMPHONYELEMENTSACTION - USERREQUESTEDTOJOINROOM - GENERICSYSTEMEVENT . [optional] # noqa: E501 - diagnostic (str): Details if event failed to parse for any reason. The contents of this field may not be useful, depending on the nature of the error. Only present when error occurs. . [optional] # noqa: E501 - initiator (V4Initiator): [optional] # noqa: E501 - payload (V4Payload): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of initiator + if self.initiator: + _dict['initiator'] = self.initiator.to_dict() + # override the default output from pydantic by calling `to_dict()` of payload + if self.payload: + _dict['payload'] = self.payload.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4Event from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "messageId": obj.get("messageId"), + "timestamp": obj.get("timestamp"), + "type": obj.get("type"), + "diagnostic": obj.get("diagnostic"), + "initiator": V4Initiator.from_dict(obj["initiator"]) if obj.get("initiator") is not None else None, + "payload": V4Payload.from_dict(obj["payload"]) if obj.get("payload") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.message_id: str = None - self.timestamp: int = None - self.type: str = None - self.diagnostic: str = None - self.initiator: V4Initiator = None - self.payload: V4Payload = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_event_list.py b/symphony/bdk/gen/agent_model/v4_event_list.py deleted file mode 100644 index 69e1c615..00000000 --- a/symphony/bdk/gen/agent_model/v4_event_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.v4_event import V4Event -globals()['V4Event'] = V4Event - -class V4EventList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V4Event],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V4EventList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V4Event]): # noqa: E501 - - Keyword Args: - value ([V4Event]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V4Event] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V4EventList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V4Event]): # noqa: E501 - - Keyword Args: - value ([V4Event]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/v4_generic_system_event.py b/symphony/bdk/gen/agent_model/v4_generic_system_event.py index c4ddc79e..39946aea 100644 --- a/symphony/bdk/gen/agent_model/v4_generic_system_event.py +++ b/symphony/bdk/gen/agent_model/v4_generic_system_event.py @@ -1,279 +1,99 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_stream import V4Stream -globals()['V4Stream'] = V4Stream - -class V4GenericSystemEvent(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4GenericSystemEvent(BaseModel): """ + V4GenericSystemEvent + """ # noqa: E501 + stream: Optional[V4Stream] = None + event_timestamp: Optional[StrictInt] = Field(default=None, description="The timestamp when the event was emitted", alias="eventTimestamp") + source_system: Optional[StrictStr] = Field(default=None, description="The name of the system that emitted the event", alias="sourceSystem") + event_subtype: Optional[StrictStr] = Field(default=None, description="The identifier of the type of generic event", alias="eventSubtype") + parameters: Optional[Dict[str, Any]] = Field(default=None, description="Free-form properties that provide context about the event") + __properties: ClassVar[List[str]] = ["stream", "eventTimestamp", "sourceSystem", "eventSubtype", "parameters"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4GenericSystemEvent from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - 'event_timestamp': (int, none_type), # noqa: E501 - 'source_system': (str, none_type), # noqa: E501 - 'event_subtype': (str, none_type), # noqa: E501 - 'parameters': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - 'event_timestamp': 'eventTimestamp', # noqa: E501 - 'source_system': 'sourceSystem', # noqa: E501 - 'event_subtype': 'eventSubtype', # noqa: E501 - 'parameters': 'parameters', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4GenericSystemEvent - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - event_timestamp (int): The timestamp when the event was emitted. [optional] # noqa: E501 - source_system (str): The name of the system that emitted the event. [optional] # noqa: E501 - event_subtype (str): The identifier of the type of generic event. [optional] # noqa: E501 - parameters ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Free-form properties that provide context about the event. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4GenericSystemEvent - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - event_timestamp (int): The timestamp when the event was emitted. [optional] # noqa: E501 - source_system (str): The name of the system that emitted the event. [optional] # noqa: E501 - event_subtype (str): The identifier of the type of generic event. [optional] # noqa: E501 - parameters ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Free-form properties that provide context about the event. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4GenericSystemEvent from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "eventTimestamp": obj.get("eventTimestamp"), + "sourceSystem": obj.get("sourceSystem"), + "eventSubtype": obj.get("eventSubtype"), + "parameters": obj.get("parameters") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - self.event_timestamp: int = None - self.source_system: str = None - self.event_subtype: str = None - self.parameters: Union[{str: (bool, date, datetime, dict, float, int, list, str, none_type)}] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_import_response.py b/symphony/bdk/gen/agent_model/v4_import_response.py index cae5bb84..5a146a11 100644 --- a/symphony/bdk/gen/agent_model/v4_import_response.py +++ b/symphony/bdk/gen/agent_model/v4_import_response.py @@ -1,271 +1,93 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class V4ImportResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4ImportResponse(BaseModel): """ + V4ImportResponse + """ # noqa: E501 + message_id: Optional[StrictStr] = Field(default=None, description="If the message was successfully imported then the message ID in the system of the newly created message. ", alias="messageId") + originating_system_id: Optional[StrictStr] = Field(default=None, description="The ID of the system through which the message was originally sent.", alias="originatingSystemId") + original_message_id: Optional[StrictStr] = Field(default=None, description="The ID of the message in the original system.", alias="originalMessageId") + diagnostic: Optional[StrictStr] = Field(default=None, description="A diagnostic message containing an error message in the event that the message import failed. May also be present in the case of a successful call if there is useful narrative to return. ") + __properties: ClassVar[List[str]] = ["messageId", "originatingSystemId", "originalMessageId", "diagnostic"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4ImportResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'message_id': (str, none_type), # noqa: E501 - 'originating_system_id': (str, none_type), # noqa: E501 - 'original_message_id': (str, none_type), # noqa: E501 - 'diagnostic': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'message_id': 'messageId', # noqa: E501 - 'originating_system_id': 'originatingSystemId', # noqa: E501 - 'original_message_id': 'originalMessageId', # noqa: E501 - 'diagnostic': 'diagnostic', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4ImportResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): If the message was successfully imported then the message ID in the system of the newly created message. . [optional] # noqa: E501 - originating_system_id (str): The ID of the system through which the message was originally sent.. [optional] # noqa: E501 - original_message_id (str): The ID of the message in the original system.. [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the message import failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4ImportResponse - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): If the message was successfully imported then the message ID in the system of the newly created message. . [optional] # noqa: E501 - originating_system_id (str): The ID of the system through which the message was originally sent.. [optional] # noqa: E501 - original_message_id (str): The ID of the message in the original system.. [optional] # noqa: E501 - diagnostic (str): A diagnostic message containing an error message in the event that the message import failed. May also be present in the case of a successful call if there is useful narrative to return. . [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4ImportResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "messageId": obj.get("messageId"), + "originatingSystemId": obj.get("originatingSystemId"), + "originalMessageId": obj.get("originalMessageId"), + "diagnostic": obj.get("diagnostic") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message_id: str = None - self.originating_system_id: str = None - self.original_message_id: str = None - self.diagnostic: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_import_response_list.py b/symphony/bdk/gen/agent_model/v4_import_response_list.py deleted file mode 100644 index 739ae970..00000000 --- a/symphony/bdk/gen/agent_model/v4_import_response_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.v4_import_response import V4ImportResponse -globals()['V4ImportResponse'] = V4ImportResponse - -class V4ImportResponseList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V4ImportResponse],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V4ImportResponseList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V4ImportResponse]): # noqa: E501 - - Keyword Args: - value ([V4ImportResponse]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V4ImportResponse] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V4ImportResponseList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V4ImportResponse]): # noqa: E501 - - Keyword Args: - value ([V4ImportResponse]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/v4_imported_message.py b/symphony/bdk/gen/agent_model/v4_imported_message.py index edbf44ba..73a4f72c 100644 --- a/symphony/bdk/gen/agent_model/v4_imported_message.py +++ b/symphony/bdk/gen/agent_model/v4_imported_message.py @@ -1,308 +1,118 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_imported_message_attachment import V4ImportedMessageAttachment -globals()['V4ImportedMessageAttachment'] = V4ImportedMessageAttachment - -class V4ImportedMessage(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4ImportedMessage(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str,), # noqa: E501 - 'intended_message_timestamp': (int,), # noqa: E501 - 'intended_message_from_user_id': (int,), # noqa: E501 - 'originating_system_id': (str,), # noqa: E501 - 'stream_id': (str,), # noqa: E501 - 'data': (str, none_type), # noqa: E501 - 'original_message_id': (str, none_type), # noqa: E501 - 'attachments': ([V4ImportedMessageAttachment], none_type), # noqa: E501 - 'previews': ([V4ImportedMessageAttachment], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message': 'message', # noqa: E501 - 'intended_message_timestamp': 'intendedMessageTimestamp', # noqa: E501 - 'intended_message_from_user_id': 'intendedMessageFromUserId', # noqa: E501 - 'originating_system_id': 'originatingSystemId', # noqa: E501 - 'stream_id': 'streamId', # noqa: E501 - 'data': 'data', # noqa: E501 - 'original_message_id': 'originalMessageId', # noqa: E501 - 'attachments': 'attachments', # noqa: E501 - 'previews': 'previews', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + A historic message to be imported into the system. The importing user must have the Content Management role. Also, the importing user must be a member of the conversation it is importing into. The user that the message is intended to have come from must also be present in the conversation. The intended message timestamp must be a valid time from the past. It cannot be a future timestamp. By design, imported messages do not stream to datafeed or firehose endpoints. + """ # noqa: E501 + message: StrictStr = Field(description="Message text in MessageMLV2") + data: Optional[StrictStr] = Field(default=None, description="Entity data in EntityJSON") + intended_message_timestamp: StrictInt = Field(description="The timestamp representing the time when the message was sent in the original system in milliseconds since Jan 1st 1970. ", alias="intendedMessageTimestamp") + intended_message_from_user_id: StrictInt = Field(description="The long integer userid of the Symphony user who you intend to show sent the message.", alias="intendedMessageFromUserId") + originating_system_id: StrictStr = Field(description="The ID of the system through which the message was originally sent.", alias="originatingSystemId") + original_message_id: Optional[StrictStr] = Field(default=None, description="The ID of the message in the original system.", alias="originalMessageId") + stream_id: StrictStr = Field(alias="streamId") + attachments: Optional[List[V4ImportedMessageAttachment]] = Field(default=None, description="List of message attachments. Since Agent 20.14.") + previews: Optional[List[V4ImportedMessageAttachment]] = Field(default=None, description="List of attachments previews. Since Agent 20.14.") + __properties: ClassVar[List[str]] = ["message", "data", "intendedMessageTimestamp", "intendedMessageFromUserId", "originatingSystemId", "originalMessageId", "streamId", "attachments", "previews"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, message, intended_message_timestamp, intended_message_from_user_id, originating_system_id, stream_id, *args, **kwargs): # noqa: E501 - """V4ImportedMessage - a agent_model defined in OpenAPI - - Args: - message (str): Message text in MessageMLV2 - intended_message_timestamp (int): The timestamp representing the time when the message was sent in the original system in milliseconds since Jan 1st 1970. - intended_message_from_user_id (int): The long integer userid of the Symphony user who you intend to show sent the message. - originating_system_id (str): The ID of the system through which the message was originally sent. - stream_id (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data (str): Entity data in EntityJSON. [optional] # noqa: E501 - original_message_id (str): The ID of the message in the original system.. [optional] # noqa: E501 - attachments ([V4ImportedMessageAttachment]): List of message attachments. Since Agent 20.14.. [optional] # noqa: E501 - previews ([V4ImportedMessageAttachment]): List of attachments previews. Since Agent 20.14.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4ImportedMessage from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.message = message - self.intended_message_timestamp = intended_message_timestamp - self.intended_message_from_user_id = intended_message_from_user_id - self.originating_system_id = originating_system_id - self.stream_id = stream_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, message, intended_message_timestamp, intended_message_from_user_id, originating_system_id, stream_id, *args, **kwargs): # noqa: E501 - """V4ImportedMessage - a agent_model defined in OpenAPI - - Args: - message (str): Message text in MessageMLV2 - intended_message_timestamp (int): The timestamp representing the time when the message was sent in the original system in milliseconds since Jan 1st 1970. - intended_message_from_user_id (int): The long integer userid of the Symphony user who you intend to show sent the message. - originating_system_id (str): The ID of the system through which the message was originally sent. - stream_id (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data (str): Entity data in EntityJSON. [optional] # noqa: E501 - original_message_id (str): The ID of the message in the original system.. [optional] # noqa: E501 - attachments ([V4ImportedMessageAttachment]): List of message attachments. Since Agent 20.14.. [optional] # noqa: E501 - previews ([V4ImportedMessageAttachment]): List of attachments previews. Since Agent 20.14.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in previews (list) + _items = [] + if self.previews: + for _item_previews in self.previews: + if _item_previews: + _items.append(_item_previews.to_dict()) + _dict['previews'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4ImportedMessage from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "message": obj.get("message"), + "data": obj.get("data"), + "intendedMessageTimestamp": obj.get("intendedMessageTimestamp"), + "intendedMessageFromUserId": obj.get("intendedMessageFromUserId"), + "originatingSystemId": obj.get("originatingSystemId"), + "originalMessageId": obj.get("originalMessageId"), + "streamId": obj.get("streamId"), + "attachments": [V4ImportedMessageAttachment.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "previews": [V4ImportedMessageAttachment.from_dict(_item) for _item in obj["previews"]] if obj.get("previews") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message: str = message - self.intended_message_timestamp: int = intended_message_timestamp - self.intended_message_from_user_id: int = intended_message_from_user_id - self.originating_system_id: str = originating_system_id - self.stream_id: str = stream_id - self.data: str = None - self.original_message_id: str = None - self.attachments: List[V4ImportedMessageAttachment] = None - self.previews: List[V4ImportedMessageAttachment] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_imported_message_attachment.py b/symphony/bdk/gen/agent_model/v4_imported_message_attachment.py index f434686f..8c53f390 100644 --- a/symphony/bdk/gen/agent_model/v4_imported_message_attachment.py +++ b/symphony/bdk/gen/agent_model/v4_imported_message_attachment.py @@ -1,261 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V4ImportedMessageAttachment(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'filename': (str, none_type), # noqa: E501 - 'content': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V4ImportedMessageAttachment(BaseModel): + """ + V4ImportedMessageAttachment + """ # noqa: E501 + filename: Optional[StrictStr] = Field(default=None, description="Attachment filename") + content: Optional[StrictStr] = Field(default=None, description="Attachment content as Base64 encoded string") + __properties: ClassVar[List[str]] = ["filename", "content"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'filename': 'filename', # noqa: E501 - 'content': 'content', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4ImportedMessageAttachment - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - filename (str): Attachment filename. [optional] # noqa: E501 - content (str): Attachment content as Base64 encoded string. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4ImportedMessageAttachment from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4ImportedMessageAttachment - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - filename (str): Attachment filename. [optional] # noqa: E501 - content (str): Attachment content as Base64 encoded string. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4ImportedMessageAttachment from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "filename": obj.get("filename"), + "content": obj.get("content") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.filename: str = None - self.content: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_initiator.py b/symphony/bdk/gen/agent_model/v4_initiator.py index a2a532cb..2873cbaf 100644 --- a/symphony/bdk/gen/agent_model/v4_initiator.py +++ b/symphony/bdk/gen/agent_model/v4_initiator.py @@ -1,259 +1,91 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_user import V4User -globals()['V4User'] = V4User +from typing import Optional, Set +from typing_extensions import Self -class V4Initiator(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4Initiator(BaseModel): """ + V4Initiator + """ # noqa: E501 + user: Optional[V4User] = None + __properties: ClassVar[List[str]] = ["user"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user': (V4User, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user': 'user', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4Initiator - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user (V4User): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4Initiator from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4Initiator - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user (V4User): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4Initiator from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "user": V4User.from_dict(obj["user"]) if obj.get("user") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user: V4User = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_instant_message_created.py b/symphony/bdk/gen/agent_model/v4_instant_message_created.py index 4ecfd97f..6084cccf 100644 --- a/symphony/bdk/gen/agent_model/v4_instant_message_created.py +++ b/symphony/bdk/gen/agent_model/v4_instant_message_created.py @@ -1,259 +1,91 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_stream import V4Stream -globals()['V4Stream'] = V4Stream +from typing import Optional, Set +from typing_extensions import Self -class V4InstantMessageCreated(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4InstantMessageCreated(BaseModel): """ + V4InstantMessageCreated + """ # noqa: E501 + stream: Optional[V4Stream] = None + __properties: ClassVar[List[str]] = ["stream"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4InstantMessageCreated - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4InstantMessageCreated from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4InstantMessageCreated - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4InstantMessageCreated from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_key_value_pair.py b/symphony/bdk/gen/agent_model/v4_key_value_pair.py index 99b07f02..781a742f 100644 --- a/symphony/bdk/gen/agent_model/v4_key_value_pair.py +++ b/symphony/bdk/gen/agent_model/v4_key_value_pair.py @@ -1,261 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V4KeyValuePair(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'key': (str, none_type), # noqa: E501 - 'value': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V4KeyValuePair(BaseModel): + """ + V4KeyValuePair + """ # noqa: E501 + key: Optional[StrictStr] = None + value: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["key", "value"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'key': 'key', # noqa: E501 - 'value': 'value', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4KeyValuePair - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - key (str): [optional] # noqa: E501 - value (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4KeyValuePair from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4KeyValuePair - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - key (str): [optional] # noqa: E501 - value (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4KeyValuePair from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.key: str = None - self.value: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_message.py b/symphony/bdk/gen/agent_model/v4_message.py index c48a8b8b..7b4eb27e 100644 --- a/symphony/bdk/gen/agent_model/v4_message.py +++ b/symphony/bdk/gen/agent_model/v4_message.py @@ -1,358 +1,146 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_attachment_info import V4AttachmentInfo from symphony.bdk.gen.agent_model.v4_stream import V4Stream from symphony.bdk.gen.agent_model.v4_user import V4User -globals()['V4AttachmentInfo'] = V4AttachmentInfo -globals()['V4Stream'] = V4Stream -globals()['V4User'] = V4User - -class V4Message(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4Message(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message_id': (str, none_type), # noqa: E501 - 'parent_message_id': (str, none_type), # noqa: E501 - 'timestamp': (int, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - 'shared_message': (V4Message, none_type), # noqa: E501 - 'data': (str, none_type), # noqa: E501 - 'attachments': ([V4AttachmentInfo], none_type), # noqa: E501 - 'user': (V4User, none_type), # noqa: E501 - 'stream': (V4Stream, none_type), # noqa: E501 - 'external_recipients': (bool, none_type), # noqa: E501 - 'diagnostic': (str, none_type), # noqa: E501 - 'user_agent': (str, none_type), # noqa: E501 - 'original_format': (str, none_type), # noqa: E501 - 'disclaimer': (str, none_type), # noqa: E501 - 'sid': (str, none_type), # noqa: E501 - 'replacing': (str, none_type), # noqa: E501 - 'replaced_by': (str, none_type), # noqa: E501 - 'initial_timestamp': (int, none_type), # noqa: E501 - 'initial_message_id': (str, none_type), # noqa: E501 - 'silent': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message_id': 'messageId', # noqa: E501 - 'parent_message_id': 'parentMessageId', # noqa: E501 - 'timestamp': 'timestamp', # noqa: E501 - 'message': 'message', # noqa: E501 - 'shared_message': 'sharedMessage', # noqa: E501 - 'data': 'data', # noqa: E501 - 'attachments': 'attachments', # noqa: E501 - 'user': 'user', # noqa: E501 - 'stream': 'stream', # noqa: E501 - 'external_recipients': 'externalRecipients', # noqa: E501 - 'diagnostic': 'diagnostic', # noqa: E501 - 'user_agent': 'userAgent', # noqa: E501 - 'original_format': 'originalFormat', # noqa: E501 - 'disclaimer': 'disclaimer', # noqa: E501 - 'sid': 'sid', # noqa: E501 - 'replacing': 'replacing', # noqa: E501 - 'replaced_by': 'replacedBy', # noqa: E501 - 'initial_timestamp': 'initialTimestamp', # noqa: E501 - 'initial_message_id': 'initialMessageId', # noqa: E501 - 'silent': 'silent', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + A representation of a message sent by a user of Symphony + """ # noqa: E501 + message_id: Optional[StrictStr] = Field(default=None, description="Id of the message", alias="messageId") + parent_message_id: Optional[StrictStr] = Field(default=None, description="Id of the parent message, set when the message is a reply to another message or a forwarded message. Since Agent 20.14.", alias="parentMessageId") + timestamp: Optional[StrictInt] = Field(default=None, description="Timestamp of the message in milliseconds since Jan 1 1970") + message: Optional[StrictStr] = Field(default=None, description="Message content in MessageMLV2") + shared_message: Optional[V4Message] = Field(default=None, alias="sharedMessage") + data: Optional[StrictStr] = Field(default=None, description="Message data in EntityJSON") + attachments: Optional[List[V4AttachmentInfo]] = Field(default=None, description="Message attachments") + user: Optional[V4User] = None + stream: Optional[V4Stream] = None + external_recipients: Optional[StrictBool] = Field(default=None, description="Indicates if the message have external recipients. Only present on real time messaging.", alias="externalRecipients") + diagnostic: Optional[StrictStr] = Field(default=None, description="Details if event failed to parse for any reason. The contents of this field may not be useful, depending on the nature of the error. Only present when error occurs. ") + user_agent: Optional[StrictStr] = Field(default=None, description="User agent string for client that sent the message. Allows callers to identify which client sent the origin message (e.g. API Agent, SFE Client, mobile, etc) ", alias="userAgent") + original_format: Optional[StrictStr] = Field(default=None, description="Indicates the format in which the message was originally sent. This could have been either: - com.symphony.markdown - Markdown OR Message ML V1 - com.symphony.messageml.v2 - Message ML V2 ", alias="originalFormat") + disclaimer: Optional[StrictStr] = Field(default=None, description="Message that may be sent along with a regular message if configured for the POD, usually the first message sent in a room that day. ") + sid: Optional[StrictStr] = Field(default=None, description="Unique session identifier from where the message was created. ") + replacing: Optional[StrictStr] = Field(default=None, description="Id of the message that the current message is replacing (present only if set)") + replaced_by: Optional[StrictStr] = Field(default=None, description="Id of the message that the current message is being replaced with (present only if set)", alias="replacedBy") + initial_timestamp: Optional[StrictInt] = Field(default=None, description="Timestamp of when the initial message has been created in milliseconds since Jan 1 1970 (present only if set) ", alias="initialTimestamp") + initial_message_id: Optional[StrictStr] = Field(default=None, description="Id the the initial message that has been updated (present only if set)", alias="initialMessageId") + silent: Optional[StrictBool] = Field(default=None, description="When false the user/s will receive the message update as unread (true by default)") + __properties: ClassVar[List[str]] = ["messageId", "parentMessageId", "timestamp", "message", "sharedMessage", "data", "attachments", "user", "stream", "externalRecipients", "diagnostic", "userAgent", "originalFormat", "disclaimer", "sid", "replacing", "replacedBy", "initialTimestamp", "initialMessageId", "silent"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4Message - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): Id of the message. [optional] # noqa: E501 - parent_message_id (str): Id of the parent message, set when the message is a reply to another message or a forwarded message. Since Agent 20.14.. [optional] # noqa: E501 - timestamp (int): Timestamp of the message in milliseconds since Jan 1 1970. [optional] # noqa: E501 - message (str): Message content in MessageMLV2. [optional] # noqa: E501 - shared_message (V4Message): [optional] # noqa: E501 - data (str): Message data in EntityJSON. [optional] # noqa: E501 - attachments ([V4AttachmentInfo]): Message attachments. [optional] if omitted the server will use the default value of [] # noqa: E501 - user (V4User): [optional] # noqa: E501 - stream (V4Stream): [optional] # noqa: E501 - external_recipients (bool): Indicates if the message have external recipients. Only present on real time messaging.. [optional] # noqa: E501 - diagnostic (str): Details if event failed to parse for any reason. The contents of this field may not be useful, depending on the nature of the error. Only present when error occurs. . [optional] # noqa: E501 - user_agent (str): User agent string for client that sent the message. Allows callers to identify which client sent the origin message (e.g. API Agent, SFE Client, mobile, etc) . [optional] # noqa: E501 - original_format (str): Indicates the format in which the message was originally sent. This could have been either: - com.symphony.markdown - Markdown OR Message ML V1 - com.symphony.messageml.v2 - Message ML V2 . [optional] # noqa: E501 - disclaimer (str): Message that may be sent along with a regular message if configured for the POD, usually the first message sent in a room that day. . [optional] # noqa: E501 - sid (str): Unique session identifier from where the message was created. . [optional] # noqa: E501 - replacing (str): Id of the message that the current message is replacing (present only if set). [optional] # noqa: E501 - replaced_by (str): Id of the message that the current message is being replaced with (present only if set). [optional] # noqa: E501 - initial_timestamp (int): Timestamp of when the initial message has been created in milliseconds since Jan 1 1970 (present only if set) . [optional] # noqa: E501 - initial_message_id (str): Id the the initial message that has been updated (present only if set). [optional] # noqa: E501 - silent (bool): When false the user/s will receive the message update as unread (true by default). [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4Message from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4Message - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): Id of the message. [optional] # noqa: E501 - parent_message_id (str): Id of the parent message, set when the message is a reply to another message or a forwarded message. Since Agent 20.14.. [optional] # noqa: E501 - timestamp (int): Timestamp of the message in milliseconds since Jan 1 1970. [optional] # noqa: E501 - message (str): Message content in MessageMLV2. [optional] # noqa: E501 - shared_message (V4Message): [optional] # noqa: E501 - data (str): Message data in EntityJSON. [optional] # noqa: E501 - attachments ([V4AttachmentInfo]): Message attachments. [optional] if omitted the server will use the default value of [] # noqa: E501 - user (V4User): [optional] # noqa: E501 - stream (V4Stream): [optional] # noqa: E501 - external_recipients (bool): Indicates if the message have external recipients. Only present on real time messaging.. [optional] # noqa: E501 - diagnostic (str): Details if event failed to parse for any reason. The contents of this field may not be useful, depending on the nature of the error. Only present when error occurs. . [optional] # noqa: E501 - user_agent (str): User agent string for client that sent the message. Allows callers to identify which client sent the origin message (e.g. API Agent, SFE Client, mobile, etc) . [optional] # noqa: E501 - original_format (str): Indicates the format in which the message was originally sent. This could have been either: - com.symphony.markdown - Markdown OR Message ML V1 - com.symphony.messageml.v2 - Message ML V2 . [optional] # noqa: E501 - disclaimer (str): Message that may be sent along with a regular message if configured for the POD, usually the first message sent in a room that day. . [optional] # noqa: E501 - sid (str): Unique session identifier from where the message was created. . [optional] # noqa: E501 - replacing (str): Id of the message that the current message is replacing (present only if set). [optional] # noqa: E501 - replaced_by (str): Id of the message that the current message is being replaced with (present only if set). [optional] # noqa: E501 - initial_timestamp (int): Timestamp of when the initial message has been created in milliseconds since Jan 1 1970 (present only if set) . [optional] # noqa: E501 - initial_message_id (str): Id the the initial message that has been updated (present only if set). [optional] # noqa: E501 - silent (bool): When false the user/s will receive the message update as unread (true by default). [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of shared_message + if self.shared_message: + _dict['sharedMessage'] = self.shared_message.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in attachments (list) + _items = [] + if self.attachments: + for _item_attachments in self.attachments: + if _item_attachments: + _items.append(_item_attachments.to_dict()) + _dict['attachments'] = _items + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4Message from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "messageId": obj.get("messageId"), + "parentMessageId": obj.get("parentMessageId"), + "timestamp": obj.get("timestamp"), + "message": obj.get("message"), + "sharedMessage": V4Message.from_dict(obj["sharedMessage"]) if obj.get("sharedMessage") is not None else None, + "data": obj.get("data"), + "attachments": [V4AttachmentInfo.from_dict(_item) for _item in obj["attachments"]] if obj.get("attachments") is not None else None, + "user": V4User.from_dict(obj["user"]) if obj.get("user") is not None else None, + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "externalRecipients": obj.get("externalRecipients"), + "diagnostic": obj.get("diagnostic"), + "userAgent": obj.get("userAgent"), + "originalFormat": obj.get("originalFormat"), + "disclaimer": obj.get("disclaimer"), + "sid": obj.get("sid"), + "replacing": obj.get("replacing"), + "replacedBy": obj.get("replacedBy"), + "initialTimestamp": obj.get("initialTimestamp"), + "initialMessageId": obj.get("initialMessageId"), + "silent": obj.get("silent") + }) + return _obj + +# TODO: Rewrite to not use raise_errors +V4Message.model_rebuild(raise_errors=False) - self.message_id: str = None - self.parent_message_id: str = None - self.timestamp: int = None - self.message: str = None - self.shared_message: V4Message = None - self.data: str = None - self.attachments: List[V4AttachmentInfo] = [] - self.user: V4User = None - self.stream: V4Stream = None - self.external_recipients: bool = None - self.diagnostic: str = None - self.user_agent: str = None - self.original_format: str = None - self.disclaimer: str = None - self.sid: str = None - self.replacing: str = None - self.replaced_by: str = None - self.initial_timestamp: int = None - self.initial_message_id: str = None - self.silent: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_message_blast_response.py b/symphony/bdk/gen/agent_model/v4_message_blast_response.py index 40da4abe..0a070e67 100644 --- a/symphony/bdk/gen/agent_model/v4_message_blast_response.py +++ b/symphony/bdk/gen/agent_model/v4_message_blast_response.py @@ -1,274 +1,110 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List from symphony.bdk.gen.agent_model.error import Error from symphony.bdk.gen.agent_model.v4_message import V4Message -globals()['Error'] = Error -globals()['V4Message'] = V4Message - -class V4MessageBlastResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4MessageBlastResponse(BaseModel): """ + Wrapper response for a single message sent to multiple streams + """ # noqa: E501 + messages: List[V4Message] = Field(description="List of messages successfully sent") + errors: Dict[str, Error] = Field(description="List of streams where the messages ingestion has failed") + __properties: ClassVar[List[str]] = ["messages", "errors"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'messages': ([V4Message],), # noqa: E501 - 'errors': ({str: (Error,)},), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'messages': 'messages', # noqa: E501 - 'errors': 'errors', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, errors, *args, **kwargs): # noqa: E501 - """V4MessageBlastResponse - a agent_model defined in OpenAPI - - Args: - errors ({str: (Error,)}): List of streams where the messages ingestion has failed - - Keyword Args: - messages ([V4Message]): List of messages successfully sent. defaults to [] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - messages = kwargs.get('messages', []) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4MessageBlastResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.messages = messages - self.errors = errors - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - @convert_js_args_to_python_args - def __init__(self, errors, *args, **kwargs): # noqa: E501 - """V4MessageBlastResponse - a agent_model defined in OpenAPI - - Args: - errors ({str: (Error,)}): List of streams where the messages ingestion has failed - - Keyword Args: - messages ([V4Message]): List of messages successfully sent. defaults to [] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in messages (list) + _items = [] + if self.messages: + for _item_messages in self.messages: + if _item_messages: + _items.append(_item_messages.to_dict()) + _dict['messages'] = _items + # override the default output from pydantic by calling `to_dict()` of each value in errors (dict) + _field_dict = {} + if self.errors: + for _key_errors in self.errors: + if self.errors[_key_errors]: + _field_dict[_key_errors] = self.errors[_key_errors].to_dict() + _dict['errors'] = _field_dict + return _dict - messages = kwargs.get('messages', []) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4MessageBlastResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "messages": [V4Message.from_dict(_item) for _item in obj["messages"]] if obj.get("messages") is not None else None, + "errors": dict( + (_k, Error.from_dict(_v)) + for _k, _v in obj["errors"].items() ) + if obj.get("errors") is not None + else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.messages: List[V4Message] = messages - self.errors: Union[{str: (Error,)}] = errors - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_message_import_list.py b/symphony/bdk/gen/agent_model/v4_message_import_list.py deleted file mode 100644 index b4d7743f..00000000 --- a/symphony/bdk/gen/agent_model/v4_message_import_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.v4_imported_message import V4ImportedMessage -globals()['V4ImportedMessage'] = V4ImportedMessage - -class V4MessageImportList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V4ImportedMessage],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V4MessageImportList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V4ImportedMessage]): An ordered list of historic messages to be imported. A list of import responses will be returned in the same order. . # noqa: E501 - - Keyword Args: - value ([V4ImportedMessage]): An ordered list of historic messages to be imported. A list of import responses will be returned in the same order. . # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V4ImportedMessage] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V4MessageImportList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V4ImportedMessage]): An ordered list of historic messages to be imported. A list of import responses will be returned in the same order. . # noqa: E501 - - Keyword Args: - value ([V4ImportedMessage]): An ordered list of historic messages to be imported. A list of import responses will be returned in the same order. . # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/v4_message_list.py b/symphony/bdk/gen/agent_model/v4_message_list.py deleted file mode 100644 index 750d43a5..00000000 --- a/symphony/bdk/gen/agent_model/v4_message_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.agent_model.v4_message import V4Message -globals()['V4Message'] = V4Message - -class V4MessageList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V4Message],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V4MessageList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V4Message]): # noqa: E501 - - Keyword Args: - value ([V4Message]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V4Message] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V4MessageList - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V4Message]): # noqa: E501 - - Keyword Args: - value ([V4Message]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/agent_model/v4_message_sent.py b/symphony/bdk/gen/agent_model/v4_message_sent.py index ff4112fe..18ecd45e 100644 --- a/symphony/bdk/gen/agent_model/v4_message_sent.py +++ b/symphony/bdk/gen/agent_model/v4_message_sent.py @@ -1,259 +1,91 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_message import V4Message -globals()['V4Message'] = V4Message +from typing import Optional, Set +from typing_extensions import Self -class V4MessageSent(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4MessageSent(BaseModel): """ + V4MessageSent + """ # noqa: E501 + message: Optional[V4Message] = None + __properties: ClassVar[List[str]] = ["message"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (V4Message, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message': 'message', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4MessageSent - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (V4Message): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4MessageSent from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4MessageSent - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (V4Message): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of message + if self.message: + _dict['message'] = self.message.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4MessageSent from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "message": V4Message.from_dict(obj["message"]) if obj.get("message") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message: V4Message = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_message_suppressed.py b/symphony/bdk/gen/agent_model/v4_message_suppressed.py index 36f30230..ecb6fe36 100644 --- a/symphony/bdk/gen/agent_model/v4_message_suppressed.py +++ b/symphony/bdk/gen/agent_model/v4_message_suppressed.py @@ -1,264 +1,93 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_stream import V4Stream -globals()['V4Stream'] = V4Stream +from typing import Optional, Set +from typing_extensions import Self -class V4MessageSuppressed(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4MessageSuppressed(BaseModel): """ + V4MessageSuppressed + """ # noqa: E501 + message_id: Optional[StrictStr] = Field(default=None, alias="messageId") + stream: Optional[V4Stream] = None + __properties: ClassVar[List[str]] = ["messageId", "stream"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message_id': (str, none_type), # noqa: E501 - 'stream': (V4Stream, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message_id': 'messageId', # noqa: E501 - 'stream': 'stream', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4MessageSuppressed - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): [optional] # noqa: E501 - stream (V4Stream): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4MessageSuppressed from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4MessageSuppressed - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): [optional] # noqa: E501 - stream (V4Stream): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4MessageSuppressed from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "messageId": obj.get("messageId"), + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message_id: str = None - self.stream: V4Stream = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_payload.py b/symphony/bdk/gen/agent_model/v4_payload.py index 6e369c70..dd8c345d 100644 --- a/symphony/bdk/gen/agent_model/v4_payload.py +++ b/symphony/bdk/gen/agent_model/v4_payload.py @@ -1,35 +1,24 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_connection_accepted import V4ConnectionAccepted from symphony.bdk.gen.agent_model.v4_connection_requested import V4ConnectionRequested from symphony.bdk.gen.agent_model.v4_generic_system_event import V4GenericSystemEvent @@ -47,325 +36,152 @@ from symphony.bdk.gen.agent_model.v4_user_joined_room import V4UserJoinedRoom from symphony.bdk.gen.agent_model.v4_user_left_room import V4UserLeftRoom from symphony.bdk.gen.agent_model.v4_user_requested_to_join_room import V4UserRequestedToJoinRoom -globals()['V4ConnectionAccepted'] = V4ConnectionAccepted -globals()['V4ConnectionRequested'] = V4ConnectionRequested -globals()['V4GenericSystemEvent'] = V4GenericSystemEvent -globals()['V4InstantMessageCreated'] = V4InstantMessageCreated -globals()['V4MessageSent'] = V4MessageSent -globals()['V4MessageSuppressed'] = V4MessageSuppressed -globals()['V4RoomCreated'] = V4RoomCreated -globals()['V4RoomDeactivated'] = V4RoomDeactivated -globals()['V4RoomMemberDemotedFromOwner'] = V4RoomMemberDemotedFromOwner -globals()['V4RoomMemberPromotedToOwner'] = V4RoomMemberPromotedToOwner -globals()['V4RoomReactivated'] = V4RoomReactivated -globals()['V4RoomUpdated'] = V4RoomUpdated -globals()['V4SharedPost'] = V4SharedPost -globals()['V4SymphonyElementsAction'] = V4SymphonyElementsAction -globals()['V4UserJoinedRoom'] = V4UserJoinedRoom -globals()['V4UserLeftRoom'] = V4UserLeftRoom -globals()['V4UserRequestedToJoinRoom'] = V4UserRequestedToJoinRoom - -class V4Payload(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4Payload(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message_sent': (V4MessageSent, none_type), # noqa: E501 - 'shared_post': (V4SharedPost, none_type), # noqa: E501 - 'instant_message_created': (V4InstantMessageCreated, none_type), # noqa: E501 - 'room_created': (V4RoomCreated, none_type), # noqa: E501 - 'room_updated': (V4RoomUpdated, none_type), # noqa: E501 - 'room_deactivated': (V4RoomDeactivated, none_type), # noqa: E501 - 'room_reactivated': (V4RoomReactivated, none_type), # noqa: E501 - 'user_joined_room': (V4UserJoinedRoom, none_type), # noqa: E501 - 'user_left_room': (V4UserLeftRoom, none_type), # noqa: E501 - 'room_member_promoted_to_owner': (V4RoomMemberPromotedToOwner, none_type), # noqa: E501 - 'room_member_demoted_from_owner': (V4RoomMemberDemotedFromOwner, none_type), # noqa: E501 - 'connection_requested': (V4ConnectionRequested, none_type), # noqa: E501 - 'connection_accepted': (V4ConnectionAccepted, none_type), # noqa: E501 - 'message_suppressed': (V4MessageSuppressed, none_type), # noqa: E501 - 'symphony_elements_action': (V4SymphonyElementsAction, none_type), # noqa: E501 - 'user_requested_to_join_room': (V4UserRequestedToJoinRoom, none_type), # noqa: E501 - 'generic_system_event': (V4GenericSystemEvent, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message_sent': 'messageSent', # noqa: E501 - 'shared_post': 'sharedPost', # noqa: E501 - 'instant_message_created': 'instantMessageCreated', # noqa: E501 - 'room_created': 'roomCreated', # noqa: E501 - 'room_updated': 'roomUpdated', # noqa: E501 - 'room_deactivated': 'roomDeactivated', # noqa: E501 - 'room_reactivated': 'roomReactivated', # noqa: E501 - 'user_joined_room': 'userJoinedRoom', # noqa: E501 - 'user_left_room': 'userLeftRoom', # noqa: E501 - 'room_member_promoted_to_owner': 'roomMemberPromotedToOwner', # noqa: E501 - 'room_member_demoted_from_owner': 'roomMemberDemotedFromOwner', # noqa: E501 - 'connection_requested': 'connectionRequested', # noqa: E501 - 'connection_accepted': 'connectionAccepted', # noqa: E501 - 'message_suppressed': 'messageSuppressed', # noqa: E501 - 'symphony_elements_action': 'symphonyElementsAction', # noqa: E501 - 'user_requested_to_join_room': 'userRequestedToJoinRoom', # noqa: E501 - 'generic_system_event': 'genericSystemEvent', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + V4Payload + """ # noqa: E501 + message_sent: Optional[V4MessageSent] = Field(default=None, alias="messageSent") + shared_post: Optional[V4SharedPost] = Field(default=None, alias="sharedPost") + instant_message_created: Optional[V4InstantMessageCreated] = Field(default=None, alias="instantMessageCreated") + room_created: Optional[V4RoomCreated] = Field(default=None, alias="roomCreated") + room_updated: Optional[V4RoomUpdated] = Field(default=None, alias="roomUpdated") + room_deactivated: Optional[V4RoomDeactivated] = Field(default=None, alias="roomDeactivated") + room_reactivated: Optional[V4RoomReactivated] = Field(default=None, alias="roomReactivated") + user_joined_room: Optional[V4UserJoinedRoom] = Field(default=None, alias="userJoinedRoom") + user_left_room: Optional[V4UserLeftRoom] = Field(default=None, alias="userLeftRoom") + room_member_promoted_to_owner: Optional[V4RoomMemberPromotedToOwner] = Field(default=None, alias="roomMemberPromotedToOwner") + room_member_demoted_from_owner: Optional[V4RoomMemberDemotedFromOwner] = Field(default=None, alias="roomMemberDemotedFromOwner") + connection_requested: Optional[V4ConnectionRequested] = Field(default=None, alias="connectionRequested") + connection_accepted: Optional[V4ConnectionAccepted] = Field(default=None, alias="connectionAccepted") + message_suppressed: Optional[V4MessageSuppressed] = Field(default=None, alias="messageSuppressed") + symphony_elements_action: Optional[V4SymphonyElementsAction] = Field(default=None, alias="symphonyElementsAction") + user_requested_to_join_room: Optional[V4UserRequestedToJoinRoom] = Field(default=None, alias="userRequestedToJoinRoom") + generic_system_event: Optional[V4GenericSystemEvent] = Field(default=None, alias="genericSystemEvent") + __properties: ClassVar[List[str]] = ["messageSent", "sharedPost", "instantMessageCreated", "roomCreated", "roomUpdated", "roomDeactivated", "roomReactivated", "userJoinedRoom", "userLeftRoom", "roomMemberPromotedToOwner", "roomMemberDemotedFromOwner", "connectionRequested", "connectionAccepted", "messageSuppressed", "symphonyElementsAction", "userRequestedToJoinRoom", "genericSystemEvent"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4Payload - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_sent (V4MessageSent): [optional] # noqa: E501 - shared_post (V4SharedPost): [optional] # noqa: E501 - instant_message_created (V4InstantMessageCreated): [optional] # noqa: E501 - room_created (V4RoomCreated): [optional] # noqa: E501 - room_updated (V4RoomUpdated): [optional] # noqa: E501 - room_deactivated (V4RoomDeactivated): [optional] # noqa: E501 - room_reactivated (V4RoomReactivated): [optional] # noqa: E501 - user_joined_room (V4UserJoinedRoom): [optional] # noqa: E501 - user_left_room (V4UserLeftRoom): [optional] # noqa: E501 - room_member_promoted_to_owner (V4RoomMemberPromotedToOwner): [optional] # noqa: E501 - room_member_demoted_from_owner (V4RoomMemberDemotedFromOwner): [optional] # noqa: E501 - connection_requested (V4ConnectionRequested): [optional] # noqa: E501 - connection_accepted (V4ConnectionAccepted): [optional] # noqa: E501 - message_suppressed (V4MessageSuppressed): [optional] # noqa: E501 - symphony_elements_action (V4SymphonyElementsAction): [optional] # noqa: E501 - user_requested_to_join_room (V4UserRequestedToJoinRoom): [optional] # noqa: E501 - generic_system_event (V4GenericSystemEvent): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4Payload from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4Payload - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_sent (V4MessageSent): [optional] # noqa: E501 - shared_post (V4SharedPost): [optional] # noqa: E501 - instant_message_created (V4InstantMessageCreated): [optional] # noqa: E501 - room_created (V4RoomCreated): [optional] # noqa: E501 - room_updated (V4RoomUpdated): [optional] # noqa: E501 - room_deactivated (V4RoomDeactivated): [optional] # noqa: E501 - room_reactivated (V4RoomReactivated): [optional] # noqa: E501 - user_joined_room (V4UserJoinedRoom): [optional] # noqa: E501 - user_left_room (V4UserLeftRoom): [optional] # noqa: E501 - room_member_promoted_to_owner (V4RoomMemberPromotedToOwner): [optional] # noqa: E501 - room_member_demoted_from_owner (V4RoomMemberDemotedFromOwner): [optional] # noqa: E501 - connection_requested (V4ConnectionRequested): [optional] # noqa: E501 - connection_accepted (V4ConnectionAccepted): [optional] # noqa: E501 - message_suppressed (V4MessageSuppressed): [optional] # noqa: E501 - symphony_elements_action (V4SymphonyElementsAction): [optional] # noqa: E501 - user_requested_to_join_room (V4UserRequestedToJoinRoom): [optional] # noqa: E501 - generic_system_event (V4GenericSystemEvent): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of message_sent + if self.message_sent: + _dict['messageSent'] = self.message_sent.to_dict() + # override the default output from pydantic by calling `to_dict()` of shared_post + if self.shared_post: + _dict['sharedPost'] = self.shared_post.to_dict() + # override the default output from pydantic by calling `to_dict()` of instant_message_created + if self.instant_message_created: + _dict['instantMessageCreated'] = self.instant_message_created.to_dict() + # override the default output from pydantic by calling `to_dict()` of room_created + if self.room_created: + _dict['roomCreated'] = self.room_created.to_dict() + # override the default output from pydantic by calling `to_dict()` of room_updated + if self.room_updated: + _dict['roomUpdated'] = self.room_updated.to_dict() + # override the default output from pydantic by calling `to_dict()` of room_deactivated + if self.room_deactivated: + _dict['roomDeactivated'] = self.room_deactivated.to_dict() + # override the default output from pydantic by calling `to_dict()` of room_reactivated + if self.room_reactivated: + _dict['roomReactivated'] = self.room_reactivated.to_dict() + # override the default output from pydantic by calling `to_dict()` of user_joined_room + if self.user_joined_room: + _dict['userJoinedRoom'] = self.user_joined_room.to_dict() + # override the default output from pydantic by calling `to_dict()` of user_left_room + if self.user_left_room: + _dict['userLeftRoom'] = self.user_left_room.to_dict() + # override the default output from pydantic by calling `to_dict()` of room_member_promoted_to_owner + if self.room_member_promoted_to_owner: + _dict['roomMemberPromotedToOwner'] = self.room_member_promoted_to_owner.to_dict() + # override the default output from pydantic by calling `to_dict()` of room_member_demoted_from_owner + if self.room_member_demoted_from_owner: + _dict['roomMemberDemotedFromOwner'] = self.room_member_demoted_from_owner.to_dict() + # override the default output from pydantic by calling `to_dict()` of connection_requested + if self.connection_requested: + _dict['connectionRequested'] = self.connection_requested.to_dict() + # override the default output from pydantic by calling `to_dict()` of connection_accepted + if self.connection_accepted: + _dict['connectionAccepted'] = self.connection_accepted.to_dict() + # override the default output from pydantic by calling `to_dict()` of message_suppressed + if self.message_suppressed: + _dict['messageSuppressed'] = self.message_suppressed.to_dict() + # override the default output from pydantic by calling `to_dict()` of symphony_elements_action + if self.symphony_elements_action: + _dict['symphonyElementsAction'] = self.symphony_elements_action.to_dict() + # override the default output from pydantic by calling `to_dict()` of user_requested_to_join_room + if self.user_requested_to_join_room: + _dict['userRequestedToJoinRoom'] = self.user_requested_to_join_room.to_dict() + # override the default output from pydantic by calling `to_dict()` of generic_system_event + if self.generic_system_event: + _dict['genericSystemEvent'] = self.generic_system_event.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4Payload from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "messageSent": V4MessageSent.from_dict(obj["messageSent"]) if obj.get("messageSent") is not None else None, + "sharedPost": V4SharedPost.from_dict(obj["sharedPost"]) if obj.get("sharedPost") is not None else None, + "instantMessageCreated": V4InstantMessageCreated.from_dict(obj["instantMessageCreated"]) if obj.get("instantMessageCreated") is not None else None, + "roomCreated": V4RoomCreated.from_dict(obj["roomCreated"]) if obj.get("roomCreated") is not None else None, + "roomUpdated": V4RoomUpdated.from_dict(obj["roomUpdated"]) if obj.get("roomUpdated") is not None else None, + "roomDeactivated": V4RoomDeactivated.from_dict(obj["roomDeactivated"]) if obj.get("roomDeactivated") is not None else None, + "roomReactivated": V4RoomReactivated.from_dict(obj["roomReactivated"]) if obj.get("roomReactivated") is not None else None, + "userJoinedRoom": V4UserJoinedRoom.from_dict(obj["userJoinedRoom"]) if obj.get("userJoinedRoom") is not None else None, + "userLeftRoom": V4UserLeftRoom.from_dict(obj["userLeftRoom"]) if obj.get("userLeftRoom") is not None else None, + "roomMemberPromotedToOwner": V4RoomMemberPromotedToOwner.from_dict(obj["roomMemberPromotedToOwner"]) if obj.get("roomMemberPromotedToOwner") is not None else None, + "roomMemberDemotedFromOwner": V4RoomMemberDemotedFromOwner.from_dict(obj["roomMemberDemotedFromOwner"]) if obj.get("roomMemberDemotedFromOwner") is not None else None, + "connectionRequested": V4ConnectionRequested.from_dict(obj["connectionRequested"]) if obj.get("connectionRequested") is not None else None, + "connectionAccepted": V4ConnectionAccepted.from_dict(obj["connectionAccepted"]) if obj.get("connectionAccepted") is not None else None, + "messageSuppressed": V4MessageSuppressed.from_dict(obj["messageSuppressed"]) if obj.get("messageSuppressed") is not None else None, + "symphonyElementsAction": V4SymphonyElementsAction.from_dict(obj["symphonyElementsAction"]) if obj.get("symphonyElementsAction") is not None else None, + "userRequestedToJoinRoom": V4UserRequestedToJoinRoom.from_dict(obj["userRequestedToJoinRoom"]) if obj.get("userRequestedToJoinRoom") is not None else None, + "genericSystemEvent": V4GenericSystemEvent.from_dict(obj["genericSystemEvent"]) if obj.get("genericSystemEvent") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message_sent: V4MessageSent = None - self.shared_post: V4SharedPost = None - self.instant_message_created: V4InstantMessageCreated = None - self.room_created: V4RoomCreated = None - self.room_updated: V4RoomUpdated = None - self.room_deactivated: V4RoomDeactivated = None - self.room_reactivated: V4RoomReactivated = None - self.user_joined_room: V4UserJoinedRoom = None - self.user_left_room: V4UserLeftRoom = None - self.room_member_promoted_to_owner: V4RoomMemberPromotedToOwner = None - self.room_member_demoted_from_owner: V4RoomMemberDemotedFromOwner = None - self.connection_requested: V4ConnectionRequested = None - self.connection_accepted: V4ConnectionAccepted = None - self.message_suppressed: V4MessageSuppressed = None - self.symphony_elements_action: V4SymphonyElementsAction = None - self.user_requested_to_join_room: V4UserRequestedToJoinRoom = None - self.generic_system_event: V4GenericSystemEvent = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_room_created.py b/symphony/bdk/gen/agent_model/v4_room_created.py index 8e6587be..d719bc7c 100644 --- a/symphony/bdk/gen/agent_model/v4_room_created.py +++ b/symphony/bdk/gen/agent_model/v4_room_created.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_room_properties import V4RoomProperties from symphony.bdk.gen.agent_model.v4_stream import V4Stream -globals()['V4RoomProperties'] = V4RoomProperties -globals()['V4Stream'] = V4Stream +from typing import Optional, Set +from typing_extensions import Self -class V4RoomCreated(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4RoomCreated(BaseModel): """ + V4RoomCreated + """ # noqa: E501 + stream: Optional[V4Stream] = None + room_properties: Optional[V4RoomProperties] = Field(default=None, alias="roomProperties") + __properties: ClassVar[List[str]] = ["stream", "roomProperties"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - 'room_properties': (V4RoomProperties, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - 'room_properties': 'roomProperties', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4RoomCreated - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - room_properties (V4RoomProperties): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4RoomCreated from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4RoomCreated - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - room_properties (V4RoomProperties): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + # override the default output from pydantic by calling `to_dict()` of room_properties + if self.room_properties: + _dict['roomProperties'] = self.room_properties.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4RoomCreated from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "roomProperties": V4RoomProperties.from_dict(obj["roomProperties"]) if obj.get("roomProperties") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - self.room_properties: V4RoomProperties = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_room_deactivated.py b/symphony/bdk/gen/agent_model/v4_room_deactivated.py index 3dc45ca8..2bfd7446 100644 --- a/symphony/bdk/gen/agent_model/v4_room_deactivated.py +++ b/symphony/bdk/gen/agent_model/v4_room_deactivated.py @@ -1,259 +1,91 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_stream import V4Stream -globals()['V4Stream'] = V4Stream +from typing import Optional, Set +from typing_extensions import Self -class V4RoomDeactivated(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4RoomDeactivated(BaseModel): """ + V4RoomDeactivated + """ # noqa: E501 + stream: Optional[V4Stream] = None + __properties: ClassVar[List[str]] = ["stream"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4RoomDeactivated - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4RoomDeactivated from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4RoomDeactivated - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4RoomDeactivated from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_room_member_demoted_from_owner.py b/symphony/bdk/gen/agent_model/v4_room_member_demoted_from_owner.py index 79c33e1c..8760f8fa 100644 --- a/symphony/bdk/gen/agent_model/v4_room_member_demoted_from_owner.py +++ b/symphony/bdk/gen/agent_model/v4_room_member_demoted_from_owner.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_stream import V4Stream from symphony.bdk.gen.agent_model.v4_user import V4User -globals()['V4Stream'] = V4Stream -globals()['V4User'] = V4User +from typing import Optional, Set +from typing_extensions import Self -class V4RoomMemberDemotedFromOwner(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4RoomMemberDemotedFromOwner(BaseModel): """ + V4RoomMemberDemotedFromOwner + """ # noqa: E501 + stream: Optional[V4Stream] = None + affected_user: Optional[V4User] = Field(default=None, alias="affectedUser") + __properties: ClassVar[List[str]] = ["stream", "affectedUser"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - 'affected_user': (V4User, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - 'affected_user': 'affectedUser', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4RoomMemberDemotedFromOwner - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - affected_user (V4User): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4RoomMemberDemotedFromOwner from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4RoomMemberDemotedFromOwner - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - affected_user (V4User): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_user + if self.affected_user: + _dict['affectedUser'] = self.affected_user.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4RoomMemberDemotedFromOwner from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "affectedUser": V4User.from_dict(obj["affectedUser"]) if obj.get("affectedUser") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - self.affected_user: V4User = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_room_member_promoted_to_owner.py b/symphony/bdk/gen/agent_model/v4_room_member_promoted_to_owner.py index edda06b2..ae3de2f5 100644 --- a/symphony/bdk/gen/agent_model/v4_room_member_promoted_to_owner.py +++ b/symphony/bdk/gen/agent_model/v4_room_member_promoted_to_owner.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_stream import V4Stream from symphony.bdk.gen.agent_model.v4_user import V4User -globals()['V4Stream'] = V4Stream -globals()['V4User'] = V4User +from typing import Optional, Set +from typing_extensions import Self -class V4RoomMemberPromotedToOwner(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4RoomMemberPromotedToOwner(BaseModel): """ + V4RoomMemberPromotedToOwner + """ # noqa: E501 + stream: Optional[V4Stream] = None + affected_user: Optional[V4User] = Field(default=None, alias="affectedUser") + __properties: ClassVar[List[str]] = ["stream", "affectedUser"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - 'affected_user': (V4User, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - 'affected_user': 'affectedUser', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4RoomMemberPromotedToOwner - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - affected_user (V4User): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4RoomMemberPromotedToOwner from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4RoomMemberPromotedToOwner - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - affected_user (V4User): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_user + if self.affected_user: + _dict['affectedUser'] = self.affected_user.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4RoomMemberPromotedToOwner from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "affectedUser": V4User.from_dict(obj["affectedUser"]) if obj.get("affectedUser") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - self.affected_user: V4User = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_room_properties.py b/symphony/bdk/gen/agent_model/v4_room_properties.py index 06383313..472d3b6b 100644 --- a/symphony/bdk/gen/agent_model/v4_room_properties.py +++ b/symphony/bdk/gen/agent_model/v4_room_properties.py @@ -1,321 +1,123 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_key_value_pair import V4KeyValuePair from symphony.bdk.gen.agent_model.v4_user import V4User -globals()['V4KeyValuePair'] = V4KeyValuePair -globals()['V4User'] = V4User - -class V4RoomProperties(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4RoomProperties(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str, none_type), # noqa: E501 - 'description': (str, none_type), # noqa: E501 - 'creator_user': (V4User, none_type), # noqa: E501 - 'created_date': (int, none_type), # noqa: E501 - 'external': (bool, none_type), # noqa: E501 - 'cross_pod': (bool, none_type), # noqa: E501 - 'public': (bool, none_type), # noqa: E501 - 'copy_protected': (bool, none_type), # noqa: E501 - 'read_only': (bool, none_type), # noqa: E501 - 'discoverable': (bool, none_type), # noqa: E501 - 'members_can_invite': (bool, none_type), # noqa: E501 - 'keywords': ([V4KeyValuePair], none_type), # noqa: E501 - 'can_view_history': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'name': 'name', # noqa: E501 - 'description': 'description', # noqa: E501 - 'creator_user': 'creatorUser', # noqa: E501 - 'created_date': 'createdDate', # noqa: E501 - 'external': 'external', # noqa: E501 - 'cross_pod': 'crossPod', # noqa: E501 - 'public': 'public', # noqa: E501 - 'copy_protected': 'copyProtected', # noqa: E501 - 'read_only': 'readOnly', # noqa: E501 - 'discoverable': 'discoverable', # noqa: E501 - 'members_can_invite': 'membersCanInvite', # noqa: E501 - 'keywords': 'keywords', # noqa: E501 - 'can_view_history': 'canViewHistory', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + V4RoomProperties + """ # noqa: E501 + name: Optional[StrictStr] = None + description: Optional[StrictStr] = None + creator_user: Optional[V4User] = Field(default=None, alias="creatorUser") + created_date: Optional[StrictInt] = Field(default=None, description="Timestamp", alias="createdDate") + external: Optional[StrictBool] = None + cross_pod: Optional[StrictBool] = Field(default=None, alias="crossPod") + public: Optional[StrictBool] = None + copy_protected: Optional[StrictBool] = Field(default=None, alias="copyProtected") + read_only: Optional[StrictBool] = Field(default=None, alias="readOnly") + discoverable: Optional[StrictBool] = None + members_can_invite: Optional[StrictBool] = Field(default=None, alias="membersCanInvite") + keywords: Optional[List[V4KeyValuePair]] = None + can_view_history: Optional[StrictBool] = Field(default=None, alias="canViewHistory") + __properties: ClassVar[List[str]] = ["name", "description", "creatorUser", "createdDate", "external", "crossPod", "public", "copyProtected", "readOnly", "discoverable", "membersCanInvite", "keywords", "canViewHistory"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4RoomProperties - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): [optional] # noqa: E501 - description (str): [optional] # noqa: E501 - creator_user (V4User): [optional] # noqa: E501 - created_date (int): Timestamp. [optional] # noqa: E501 - external (bool): [optional] # noqa: E501 - cross_pod (bool): [optional] # noqa: E501 - public (bool): [optional] # noqa: E501 - copy_protected (bool): [optional] # noqa: E501 - read_only (bool): [optional] # noqa: E501 - discoverable (bool): [optional] # noqa: E501 - members_can_invite (bool): [optional] # noqa: E501 - keywords ([V4KeyValuePair]): [optional] if omitted the server will use the default value of [] # noqa: E501 - can_view_history (bool): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4RoomProperties from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4RoomProperties - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): [optional] # noqa: E501 - description (str): [optional] # noqa: E501 - creator_user (V4User): [optional] # noqa: E501 - created_date (int): Timestamp. [optional] # noqa: E501 - external (bool): [optional] # noqa: E501 - cross_pod (bool): [optional] # noqa: E501 - public (bool): [optional] # noqa: E501 - copy_protected (bool): [optional] # noqa: E501 - read_only (bool): [optional] # noqa: E501 - discoverable (bool): [optional] # noqa: E501 - members_can_invite (bool): [optional] # noqa: E501 - keywords ([V4KeyValuePair]): [optional] if omitted the server will use the default value of [] # noqa: E501 - can_view_history (bool): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of creator_user + if self.creator_user: + _dict['creatorUser'] = self.creator_user.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in keywords (list) + _items = [] + if self.keywords: + for _item_keywords in self.keywords: + if _item_keywords: + _items.append(_item_keywords.to_dict()) + _dict['keywords'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4RoomProperties from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "description": obj.get("description"), + "creatorUser": V4User.from_dict(obj["creatorUser"]) if obj.get("creatorUser") is not None else None, + "createdDate": obj.get("createdDate"), + "external": obj.get("external"), + "crossPod": obj.get("crossPod"), + "public": obj.get("public"), + "copyProtected": obj.get("copyProtected"), + "readOnly": obj.get("readOnly"), + "discoverable": obj.get("discoverable"), + "membersCanInvite": obj.get("membersCanInvite"), + "keywords": [V4KeyValuePair.from_dict(_item) for _item in obj["keywords"]] if obj.get("keywords") is not None else None, + "canViewHistory": obj.get("canViewHistory") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.description: str = None - self.creator_user: V4User = None - self.created_date: int = None - self.external: bool = None - self.cross_pod: bool = None - self.public: bool = None - self.copy_protected: bool = None - self.read_only: bool = None - self.discoverable: bool = None - self.members_can_invite: bool = None - self.keywords: List[V4KeyValuePair] = [] - self.can_view_history: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_room_reactivated.py b/symphony/bdk/gen/agent_model/v4_room_reactivated.py index a9d2fa77..bf1750d7 100644 --- a/symphony/bdk/gen/agent_model/v4_room_reactivated.py +++ b/symphony/bdk/gen/agent_model/v4_room_reactivated.py @@ -1,259 +1,91 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_stream import V4Stream -globals()['V4Stream'] = V4Stream +from typing import Optional, Set +from typing_extensions import Self -class V4RoomReactivated(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4RoomReactivated(BaseModel): """ + V4RoomReactivated + """ # noqa: E501 + stream: Optional[V4Stream] = None + __properties: ClassVar[List[str]] = ["stream"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4RoomReactivated - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4RoomReactivated from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4RoomReactivated - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4RoomReactivated from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_room_updated.py b/symphony/bdk/gen/agent_model/v4_room_updated.py index 99682203..fff864cb 100644 --- a/symphony/bdk/gen/agent_model/v4_room_updated.py +++ b/symphony/bdk/gen/agent_model/v4_room_updated.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_room_properties import V4RoomProperties from symphony.bdk.gen.agent_model.v4_stream import V4Stream -globals()['V4RoomProperties'] = V4RoomProperties -globals()['V4Stream'] = V4Stream +from typing import Optional, Set +from typing_extensions import Self -class V4RoomUpdated(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4RoomUpdated(BaseModel): """ + V4RoomUpdated + """ # noqa: E501 + stream: Optional[V4Stream] = None + new_room_properties: Optional[V4RoomProperties] = Field(default=None, alias="newRoomProperties") + __properties: ClassVar[List[str]] = ["stream", "newRoomProperties"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - 'new_room_properties': (V4RoomProperties, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - 'new_room_properties': 'newRoomProperties', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4RoomUpdated - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - new_room_properties (V4RoomProperties): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4RoomUpdated from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4RoomUpdated - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - new_room_properties (V4RoomProperties): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + # override the default output from pydantic by calling `to_dict()` of new_room_properties + if self.new_room_properties: + _dict['newRoomProperties'] = self.new_room_properties.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4RoomUpdated from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "newRoomProperties": V4RoomProperties.from_dict(obj["newRoomProperties"]) if obj.get("newRoomProperties") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - self.new_room_properties: V4RoomProperties = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_shared_post.py b/symphony/bdk/gen/agent_model/v4_shared_post.py index d7b31466..fb4089b9 100644 --- a/symphony/bdk/gen/agent_model/v4_shared_post.py +++ b/symphony/bdk/gen/agent_model/v4_shared_post.py @@ -1,264 +1,96 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_message import V4Message -globals()['V4Message'] = V4Message +from typing import Optional, Set +from typing_extensions import Self -class V4SharedPost(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4SharedPost(BaseModel): """ + V4SharedPost + """ # noqa: E501 + message: Optional[V4Message] = None + shared_message: Optional[V4Message] = Field(default=None, alias="sharedMessage") + __properties: ClassVar[List[str]] = ["message", "sharedMessage"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (V4Message, none_type), # noqa: E501 - 'shared_message': (V4Message, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message': 'message', # noqa: E501 - 'shared_message': 'sharedMessage', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4SharedPost - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (V4Message): [optional] # noqa: E501 - shared_message (V4Message): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4SharedPost from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4SharedPost - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (V4Message): [optional] # noqa: E501 - shared_message (V4Message): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of message + if self.message: + _dict['message'] = self.message.to_dict() + # override the default output from pydantic by calling `to_dict()` of shared_message + if self.shared_message: + _dict['sharedMessage'] = self.shared_message.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4SharedPost from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "message": V4Message.from_dict(obj["message"]) if obj.get("message") is not None else None, + "sharedMessage": V4Message.from_dict(obj["sharedMessage"]) if obj.get("sharedMessage") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message: V4Message = None - self.shared_message: V4Message = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_stream.py b/symphony/bdk/gen/agent_model/v4_stream.py index 51cc882e..c6c14781 100644 --- a/symphony/bdk/gen/agent_model/v4_stream.py +++ b/symphony/bdk/gen/agent_model/v4_stream.py @@ -1,289 +1,107 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_user import V4User -globals()['V4User'] = V4User - -class V4Stream(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4Stream(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream_id': (str, none_type), # noqa: E501 - 'stream_type': (str, none_type), # noqa: E501 - 'room_name': (str, none_type), # noqa: E501 - 'members': ([V4User], none_type), # noqa: E501 - 'external': (bool, none_type), # noqa: E501 - 'cross_pod': (bool, none_type), # noqa: E501 - 'recipient_tenant_ids': ([int], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream_id': 'streamId', # noqa: E501 - 'stream_type': 'streamType', # noqa: E501 - 'room_name': 'roomName', # noqa: E501 - 'members': 'members', # noqa: E501 - 'external': 'external', # noqa: E501 - 'cross_pod': 'crossPod', # noqa: E501 - 'recipient_tenant_ids': 'recipientTenantIds', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + V4Stream + """ # noqa: E501 + stream_id: Optional[StrictStr] = Field(default=None, description="Id of stream", alias="streamId") + stream_type: Optional[StrictStr] = Field(default=None, description="Stream type, possible values are: - IM - MIM - ROOM - POST ", alias="streamType") + room_name: Optional[StrictStr] = Field(default=None, description="Applicable only to rooms", alias="roomName") + members: Optional[List[V4User]] = Field(default=None, description="Applicable only to IM Created") + external: Optional[StrictBool] = None + cross_pod: Optional[StrictBool] = Field(default=None, alias="crossPod") + recipient_tenant_ids: Optional[List[StrictInt]] = Field(default=None, description="List of tenant identifiers (aka pod identifiers) involved in the conversation. It contains more than one item if the conversation is external. Field is only present for real time messaging. ", alias="recipientTenantIds") + __properties: ClassVar[List[str]] = ["streamId", "streamType", "roomName", "members", "external", "crossPod", "recipientTenantIds"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4Stream - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream_id (str): Id of stream. [optional] # noqa: E501 - stream_type (str): Stream type, possible values are: - IM - MIM - ROOM - POST . [optional] # noqa: E501 - room_name (str): Applicable only to rooms. [optional] # noqa: E501 - members ([V4User]): Applicable only to IM Created. [optional] # noqa: E501 - external (bool): [optional] # noqa: E501 - cross_pod (bool): [optional] # noqa: E501 - recipient_tenant_ids ([int]): List of tenant identifiers (aka pod identifiers) involved in the conversation. It contains more than one item if the conversation is external. Field is only present for real time messaging. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4Stream from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4Stream - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream_id (str): Id of stream. [optional] # noqa: E501 - stream_type (str): Stream type, possible values are: - IM - MIM - ROOM - POST . [optional] # noqa: E501 - room_name (str): Applicable only to rooms. [optional] # noqa: E501 - members ([V4User]): Applicable only to IM Created. [optional] # noqa: E501 - external (bool): [optional] # noqa: E501 - cross_pod (bool): [optional] # noqa: E501 - recipient_tenant_ids ([int]): List of tenant identifiers (aka pod identifiers) involved in the conversation. It contains more than one item if the conversation is external. Field is only present for real time messaging. . [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in members (list) + _items = [] + if self.members: + for _item_members in self.members: + if _item_members: + _items.append(_item_members.to_dict()) + _dict['members'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4Stream from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "streamId": obj.get("streamId"), + "streamType": obj.get("streamType"), + "roomName": obj.get("roomName"), + "members": [V4User.from_dict(_item) for _item in obj["members"]] if obj.get("members") is not None else None, + "external": obj.get("external"), + "crossPod": obj.get("crossPod"), + "recipientTenantIds": obj.get("recipientTenantIds") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream_id: str = None - self.stream_type: str = None - self.room_name: str = None - self.members: List[V4User] = None - self.external: bool = None - self.cross_pod: bool = None - self.recipient_tenant_ids: List[int] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_symphony_elements_action.py b/symphony/bdk/gen/agent_model/v4_symphony_elements_action.py index 61a59136..74f3a21f 100644 --- a/symphony/bdk/gen/agent_model/v4_symphony_elements_action.py +++ b/symphony/bdk/gen/agent_model/v4_symphony_elements_action.py @@ -1,274 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_stream import V4Stream -globals()['V4Stream'] = V4Stream - -class V4SymphonyElementsAction(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4SymphonyElementsAction(BaseModel): """ + V4SymphonyElementsAction + """ # noqa: E501 + stream: Optional[V4Stream] = None + form_message_id: Optional[StrictStr] = Field(default=None, description="The id of the message that contains the Form", alias="formMessageId") + form_id: Optional[StrictStr] = Field(default=None, description="The id of the Form element", alias="formId") + form_values: Optional[Dict[str, Any]] = Field(default=None, description="The values (in JSON format) answered on the Form", alias="formValues") + __properties: ClassVar[List[str]] = ["stream", "formMessageId", "formId", "formValues"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4SymphonyElementsAction from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - 'form_message_id': (str, none_type), # noqa: E501 - 'form_id': (str, none_type), # noqa: E501 - 'form_values': ({str: (str,)}, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - 'form_message_id': 'formMessageId', # noqa: E501 - 'form_id': 'formId', # noqa: E501 - 'form_values': 'formValues', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4SymphonyElementsAction - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - form_message_id (str): The id of the message that contains the Form. [optional] # noqa: E501 - form_id (str): The id of the Form element. [optional] # noqa: E501 - form_values ({str: (str,)}): The values (in JSON format) answered on the Form. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4SymphonyElementsAction - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - form_message_id (str): The id of the message that contains the Form. [optional] # noqa: E501 - form_id (str): The id of the Form element. [optional] # noqa: E501 - form_values ({str: (str,)}): The values (in JSON format) answered on the Form. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4SymphonyElementsAction from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "formMessageId": obj.get("formMessageId"), + "formId": obj.get("formId"), + "formValues": obj.get("formValues") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - self.form_message_id: str = None - self.form_id: str = None - self.form_values: Union[{str: (str,)}] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_thumbnail_info.py b/symphony/bdk/gen/agent_model/v4_thumbnail_info.py index 5a2992a6..45356592 100644 --- a/symphony/bdk/gen/agent_model/v4_thumbnail_info.py +++ b/symphony/bdk/gen/agent_model/v4_thumbnail_info.py @@ -1,261 +1,89 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V4ThumbnailInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'dimension': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V4ThumbnailInfo(BaseModel): + """ + V4ThumbnailInfo + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The thumbnail ID.") + dimension: Optional[StrictStr] = Field(default=None, description="The thumbnail pixel size.") + __properties: ClassVar[List[str]] = ["id", "dimension"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - 'dimension': 'dimension', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4ThumbnailInfo - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The thumbnail ID.. [optional] # noqa: E501 - dimension (str): The thumbnail pixel size.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4ThumbnailInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4ThumbnailInfo - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The thumbnail ID.. [optional] # noqa: E501 - dimension (str): The thumbnail pixel size.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4ThumbnailInfo from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "dimension": obj.get("dimension") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.dimension: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_user.py b/symphony/bdk/gen/agent_model/v4_user.py index aad63236..6f80b526 100644 --- a/symphony/bdk/gen/agent_model/v4_user.py +++ b/symphony/bdk/gen/agent_model/v4_user.py @@ -1,281 +1,97 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class V4User(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4User(BaseModel): """ + V4User + """ # noqa: E501 + user_id: Optional[StrictInt] = Field(default=None, description="Id of user", alias="userId") + first_name: Optional[StrictStr] = Field(default=None, description="First name of user", alias="firstName") + last_name: Optional[StrictStr] = Field(default=None, description="Last name of user", alias="lastName") + display_name: Optional[StrictStr] = Field(default=None, description="User display name", alias="displayName") + email: Optional[StrictStr] = Field(default=None, description="Email of user") + username: Optional[StrictStr] = Field(default=None, description="Applicable only to internal users") + __properties: ClassVar[List[str]] = ["userId", "firstName", "lastName", "displayName", "email", "username"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4User from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'user_id': (int, none_type), # noqa: E501 - 'first_name': (str, none_type), # noqa: E501 - 'last_name': (str, none_type), # noqa: E501 - 'display_name': (str, none_type), # noqa: E501 - 'email': (str, none_type), # noqa: E501 - 'username': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'user_id': 'userId', # noqa: E501 - 'first_name': 'firstName', # noqa: E501 - 'last_name': 'lastName', # noqa: E501 - 'display_name': 'displayName', # noqa: E501 - 'email': 'email', # noqa: E501 - 'username': 'username', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4User - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): Id of user. [optional] # noqa: E501 - first_name (str): First name of user. [optional] # noqa: E501 - last_name (str): Last name of user. [optional] # noqa: E501 - display_name (str): User display name. [optional] # noqa: E501 - email (str): Email of user. [optional] # noqa: E501 - username (str): Applicable only to internal users. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4User - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): Id of user. [optional] # noqa: E501 - first_name (str): First name of user. [optional] # noqa: E501 - last_name (str): Last name of user. [optional] # noqa: E501 - display_name (str): User display name. [optional] # noqa: E501 - email (str): Email of user. [optional] # noqa: E501 - username (str): Applicable only to internal users. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4User from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "userId": obj.get("userId"), + "firstName": obj.get("firstName"), + "lastName": obj.get("lastName"), + "displayName": obj.get("displayName"), + "email": obj.get("email"), + "username": obj.get("username") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_id: int = None - self.first_name: str = None - self.last_name: str = None - self.display_name: str = None - self.email: str = None - self.username: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_user_joined_room.py b/symphony/bdk/gen/agent_model/v4_user_joined_room.py index 60f8e6fe..640e426a 100644 --- a/symphony/bdk/gen/agent_model/v4_user_joined_room.py +++ b/symphony/bdk/gen/agent_model/v4_user_joined_room.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_stream import V4Stream from symphony.bdk.gen.agent_model.v4_user import V4User -globals()['V4Stream'] = V4Stream -globals()['V4User'] = V4User +from typing import Optional, Set +from typing_extensions import Self -class V4UserJoinedRoom(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4UserJoinedRoom(BaseModel): """ + V4UserJoinedRoom + """ # noqa: E501 + stream: Optional[V4Stream] = None + affected_user: Optional[V4User] = Field(default=None, alias="affectedUser") + __properties: ClassVar[List[str]] = ["stream", "affectedUser"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - 'affected_user': (V4User, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - 'affected_user': 'affectedUser', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4UserJoinedRoom - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - affected_user (V4User): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4UserJoinedRoom from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4UserJoinedRoom - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - affected_user (V4User): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_user + if self.affected_user: + _dict['affectedUser'] = self.affected_user.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4UserJoinedRoom from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "affectedUser": V4User.from_dict(obj["affectedUser"]) if obj.get("affectedUser") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - self.affected_user: V4User = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_user_left_room.py b/symphony/bdk/gen/agent_model/v4_user_left_room.py index ec8fce4f..b0ed0238 100644 --- a/symphony/bdk/gen/agent_model/v4_user_left_room.py +++ b/symphony/bdk/gen/agent_model/v4_user_left_room.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_stream import V4Stream from symphony.bdk.gen.agent_model.v4_user import V4User -globals()['V4Stream'] = V4Stream -globals()['V4User'] = V4User +from typing import Optional, Set +from typing_extensions import Self -class V4UserLeftRoom(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4UserLeftRoom(BaseModel): """ + V4UserLeftRoom + """ # noqa: E501 + stream: Optional[V4Stream] = None + affected_user: Optional[V4User] = Field(default=None, alias="affectedUser") + __properties: ClassVar[List[str]] = ["stream", "affectedUser"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - 'affected_user': (V4User, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - 'affected_user': 'affectedUser', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4UserLeftRoom - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - affected_user (V4User): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4UserLeftRoom from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4UserLeftRoom - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - affected_user (V4User): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_user + if self.affected_user: + _dict['affectedUser'] = self.affected_user.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4UserLeftRoom from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "affectedUser": V4User.from_dict(obj["affectedUser"]) if obj.get("affectedUser") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - self.affected_user: V4User = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v4_user_requested_to_join_room.py b/symphony/bdk/gen/agent_model/v4_user_requested_to_join_room.py index 8390dde4..12c4baf8 100644 --- a/symphony/bdk/gen/agent_model/v4_user_requested_to_join_room.py +++ b/symphony/bdk/gen/agent_model/v4_user_requested_to_join_room.py @@ -1,266 +1,101 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_stream import V4Stream from symphony.bdk.gen.agent_model.v4_user import V4User -globals()['V4Stream'] = V4Stream -globals()['V4User'] = V4User +from typing import Optional, Set +from typing_extensions import Self -class V4UserRequestedToJoinRoom(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V4UserRequestedToJoinRoom(BaseModel): """ + V4UserRequestedToJoinRoom + """ # noqa: E501 + stream: Optional[V4Stream] = None + affected_users: Optional[List[V4User]] = Field(default=None, description="List of affected users by the action (i.e. owners of the room)", alias="affectedUsers") + __properties: ClassVar[List[str]] = ["stream", "affectedUsers"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream': (V4Stream, none_type), # noqa: E501 - 'affected_users': ([V4User], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream': 'stream', # noqa: E501 - 'affected_users': 'affectedUsers', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V4UserRequestedToJoinRoom - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - affected_users ([V4User]): List of affected users by the action (i.e. owners of the room). [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V4UserRequestedToJoinRoom from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V4UserRequestedToJoinRoom - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream (V4Stream): [optional] # noqa: E501 - affected_users ([V4User]): List of affected users by the action (i.e. owners of the room). [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in affected_users (list) + _items = [] + if self.affected_users: + for _item_affected_users in self.affected_users: + if _item_affected_users: + _items.append(_item_affected_users.to_dict()) + _dict['affectedUsers'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V4UserRequestedToJoinRoom from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "stream": V4Stream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "affectedUsers": [V4User.from_dict(_item) for _item in obj["affectedUsers"]] if obj.get("affectedUsers") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream: V4Stream = None - self.affected_users: List[V4User] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v5_datafeed.py b/symphony/bdk/gen/agent_model/v5_datafeed.py index 55959634..ad94b084 100644 --- a/symphony/bdk/gen/agent_model/v5_datafeed.py +++ b/symphony/bdk/gen/agent_model/v5_datafeed.py @@ -1,266 +1,91 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V5Datafeed(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'created_at': (int, none_type), # noqa: E501 - 'type': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V5Datafeed(BaseModel): + """ + Container for the feed ID + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="ID of the datafeed") + created_at: Optional[StrictInt] = Field(default=None, description="[deprecated] Datafeed creation timestamp ", alias="createdAt") + type: Optional[StrictStr] = Field(default=None, description="The type of feed. Only allowed value is \"datahose\".") + __properties: ClassVar[List[str]] = ["id", "createdAt", "type"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - 'created_at': 'createdAt', # noqa: E501 - 'type': 'type', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V5Datafeed - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): ID of the datafeed. [optional] # noqa: E501 - created_at (int): [deprecated] Datafeed creation timestamp . [optional] # noqa: E501 - type (str): The type of feed. Only allowed value is \"datahose\".. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V5Datafeed from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V5Datafeed - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): ID of the datafeed. [optional] # noqa: E501 - created_at (int): [deprecated] Datafeed creation timestamp . [optional] # noqa: E501 - type (str): The type of feed. Only allowed value is \"datahose\".. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V5Datafeed from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "createdAt": obj.get("createdAt"), + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.created_at: int = None - self.type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v5_datafeed_create_body.py b/symphony/bdk/gen/agent_model/v5_datafeed_create_body.py index a9ced18b..3ec212a8 100644 --- a/symphony/bdk/gen/agent_model/v5_datafeed_create_body.py +++ b/symphony/bdk/gen/agent_model/v5_datafeed_create_body.py @@ -1,259 +1,88 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V5DatafeedCreateBody(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - ('tag',): { - 'max_length': 100, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'tag': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V5DatafeedCreateBody(BaseModel): + """ + V5DatafeedCreateBody + """ # noqa: E501 + tag: Optional[Annotated[str, Field(strict=True, max_length=100)]] = Field(default=None, description="A unique identifier to ensure uniqueness of the datafeed.") + __properties: ClassVar[List[str]] = ["tag"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'tag': 'tag', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V5DatafeedCreateBody - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - tag (str): A unique identifier to ensure uniqueness of the datafeed.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V5DatafeedCreateBody from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V5DatafeedCreateBody - a agent_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - tag (str): A unique identifier to ensure uniqueness of the datafeed.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V5DatafeedCreateBody from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "tag": obj.get("tag") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.tag: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v5_datafeed_event_type.py b/symphony/bdk/gen/agent_model/v5_datafeed_event_type.py deleted file mode 100644 index 2d04657e..00000000 --- a/symphony/bdk/gen/agent_model/v5_datafeed_event_type.py +++ /dev/null @@ -1,185 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - A new authorizationToken has been introduced in the authenticationAPI response payload. It can be used to replace the sessionToken in any of the API calls and can be passed as \"Authorization\" header. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 20.14.0-SNAPSHOT - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - - -class V5DatafeedEventType(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('value',): { - 'SOCIALMESSAGE': "SOCIALMESSAGE", - 'CREATE_ROOM': "CREATE_ROOM", - 'UPDATE_ROOM': "UPDATE_ROOM", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': (str,), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V5DatafeedEventType - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): A string representing the event type allowed to go through in the related feed.., must be one of ["SOCIALMESSAGE", "CREATE_ROOM", "UPDATE_ROOM", ] # noqa: E501 - - Keyword Args: - value (str): A string representing the event type allowed to go through in the related feed.., must be one of ["SOCIALMESSAGE", "CREATE_ROOM", "UPDATE_ROOM", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: str = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) diff --git a/symphony/bdk/gen/agent_model/v5_datafeed_type.py b/symphony/bdk/gen/agent_model/v5_datafeed_type.py deleted file mode 100644 index 448e20a1..00000000 --- a/symphony/bdk/gen/agent_model/v5_datafeed_type.py +++ /dev/null @@ -1,184 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - A new authorizationToken has been introduced in the authenticationAPI response payload. It can be used to replace the sessionToken in any of the API calls and can be passed as \"Authorization\" header. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 20.14.0-SNAPSHOT - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - - -class V5DatafeedType(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('value',): { - 'DATAHOSE': "datahose", - 'FANOUT': "fanout", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': (str,), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V5DatafeedType - a agent_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Different types will drive how DF2 components handle the message dispatching mechaninsm implementation.., must be one of ["datahose", "fanout", ] # noqa: E501 - - Keyword Args: - value (str): Different types will drive how DF2 components handle the message dispatching mechaninsm implementation.., must be one of ["datahose", "fanout", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: str = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) diff --git a/symphony/bdk/gen/agent_model/v5_event_list.py b/symphony/bdk/gen/agent_model/v5_event_list.py index 9832c1fa..3a7d55d3 100644 --- a/symphony/bdk/gen/agent_model/v5_event_list.py +++ b/symphony/bdk/gen/agent_model/v5_event_list.py @@ -1,264 +1,97 @@ +# coding: utf-8 + """ Agent API - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech -""" + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.agent_model.v4_event import V4Event -globals()['V4Event'] = V4Event +from typing import Optional, Set +from typing_extensions import Self -class V5EventList(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V5EventList(BaseModel): """ + V5EventList + """ # noqa: E501 + events: Optional[List[V4Event]] = None + ack_id: Optional[StrictStr] = Field(default=None, description="The ackId which acknowledges that the current batch of messages have been successfully received by the client ", alias="ackId") + __properties: ClassVar[List[str]] = ["events", "ackId"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'events': ([V4Event], none_type), # noqa: E501 - 'ack_id': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'events': 'events', # noqa: E501 - 'ack_id': 'ackId', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V5EventList - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - events ([V4Event]): [optional] if omitted the server will use the default value of [] # noqa: E501 - ack_id (str): The ackId which acknowledges that the current batch of messages have been successfully received by the client . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V5EventList from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V5EventList - a agent_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - events ([V4Event]): [optional] if omitted the server will use the default value of [] # noqa: E501 - ack_id (str): The ackId which acknowledges that the current batch of messages have been successfully received by the client . [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in events (list) + _items = [] + if self.events: + for _item_events in self.events: + if _item_events: + _items.append(_item_events.to_dict()) + _dict['events'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V5EventList from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "events": [V4Event.from_dict(_item) for _item in obj["events"]] if obj.get("events") is not None else None, + "ackId": obj.get("ackId") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.events: List[V4Event] = [] - self.ack_id: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/agent_model/v5_events_read_body.py b/symphony/bdk/gen/agent_model/v5_events_read_body.py index ca3ef1fe..7756c809 100644 --- a/symphony/bdk/gen/agent_model/v5_events_read_body.py +++ b/symphony/bdk/gen/agent_model/v5_events_read_body.py @@ -1,286 +1,98 @@ -""" - Agent API +# coding: utf-8 - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 24.12.1 - Generated by: https://openapi-generator.tech """ + Agent API + This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://rest-api.symphony.com/docs/messagemlv2 - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + The version of the OpenAPI document: 25.8.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class V5EventsReadBody(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V5EventsReadBody(BaseModel): """ + V5EventsReadBody + """ # noqa: E501 + type: StrictStr = Field(description="The type of feed. Only allowed value is \"datahose\".") + tag: Annotated[str, Field(min_length=1, strict=True, max_length=80)] = Field(description="A unique identifier to ensure uniqueness of the datafeed.") + event_types: Optional[List[StrictStr]] = Field(default=None, description="At least one value is required. Values must be valid Real-Time Events, i.e. one of: * MESSAGESENT * MESSAGESUPPRESSED * SYMPHONYELEMENTSACTION * SHAREDPOST * INSTANTMESSAGECREATED * ROOMCREATED * ROOMUPDATED * ROOMDEACTIVATED * ROOMREACTIVATED * USERREQUESTEDTOJOINROOM * USERJOINEDROOM * USERLEFTROOM * ROOMMEMBERPROMOTEDTOOWNER * ROOMMEMBERDEMOTEDFROMOWNER * CONNECTIONREQUESTED * CONNECTIONACCEPTED ", alias="eventTypes") + scopes: Optional[List[StrictStr]] = Field(default=None, description="Allows to filter events by scope Scopes supported: * INTERNAL: Only events related to chats that are Internal are received. Shared Wall posts are included * EXTERNAL: Only events related to chats that are External are received. Connection Requested/Accepted events are included * FEDERATED: Only events related to chats that are Federated are received. Events that are not related to streams (Shared Wall Post, Connection Requested/Accepted) are not included. If more than one scope is set, then events included in the union of scopes will be received. If not set, then all events will be received. ") + ack_id: Optional[StrictStr] = Field(default=None, description="Must be omitted or set as an empty string for the first call. In successive calls, it must be set to the last read ackId. It acknowledges that the current batch of messages have been successfully received by the client. ", alias="ackId") + update_presence: Optional[StrictBool] = Field(default=True, description="Whether to update the presence status of the account to AVAILABLE when calling the endpoint. Default value is true. ", alias="updatePresence") + __properties: ClassVar[List[str]] = ["type", "tag", "eventTypes", "scopes", "ackId", "updatePresence"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - ('tag',): { - 'max_length': 80, - 'min_length': 1, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V5EventsReadBody from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a agent_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'type': (str,), # noqa: E501 - 'tag': (str,), # noqa: E501 - 'event_types': ([str], none_type), # noqa: E501 - 'ack_id': (str, none_type), # noqa: E501 - 'update_presence': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - + excluded_fields: Set[str] = set([ + ]) - attribute_map = { - 'type': 'type', # noqa: E501 - 'tag': 'tag', # noqa: E501 - 'event_types': 'eventTypes', # noqa: E501 - 'ack_id': 'ackId', # noqa: E501 - 'update_presence': 'updatePresence', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, type, tag, *args, **kwargs): # noqa: E501 - """V5EventsReadBody - a agent_model defined in OpenAPI - - Args: - type (str): The type of feed. Only allowed value is \"datahose\". - tag (str): A unique identifier to ensure uniqueness of the datafeed. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - event_types ([str]): At least one value is required. Values must be valid Real-Time Events, i.e. one of: * MESSAGESENT * MESSAGESUPPRESSED * SYMPHONYELEMENTSACTION * SHAREDPOST * INSTANTMESSAGECREATED * ROOMCREATED * ROOMUPDATED * ROOMDEACTIVATED * ROOMREACTIVATED * USERREQUESTEDTOJOINROOM * USERJOINEDROOM * USERLEFTROOM * ROOMMEMBERPROMOTEDTOOWNER * ROOMMEMBERDEMOTEDFROMOWNER * CONNECTIONREQUESTED * CONNECTIONACCEPTED . [optional] # noqa: E501 - ack_id (str): Should be empty for the first call, acknowledges that the current batch of messages have been successfully received by the client. . [optional] # noqa: E501 - update_presence (bool): Whether to update the presence status of the account to AVAILABLE when calling the endpoint. Default value is true. . [optional] if omitted the server will use the default value of True # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.type = type - self.tag = tag - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, type, tag, *args, **kwargs): # noqa: E501 - """V5EventsReadBody - a agent_model defined in OpenAPI - - Args: - type (str): The type of feed. Only allowed value is \"datahose\". - tag (str): A unique identifier to ensure uniqueness of the datafeed. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the agent_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - event_types ([str]): At least one value is required. Values must be valid Real-Time Events, i.e. one of: * MESSAGESENT * MESSAGESUPPRESSED * SYMPHONYELEMENTSACTION * SHAREDPOST * INSTANTMESSAGECREATED * ROOMCREATED * ROOMUPDATED * ROOMDEACTIVATED * ROOMREACTIVATED * USERREQUESTEDTOJOINROOM * USERJOINEDROOM * USERLEFTROOM * ROOMMEMBERPROMOTEDTOOWNER * ROOMMEMBERDEMOTEDFROMOWNER * CONNECTIONREQUESTED * CONNECTIONACCEPTED . [optional] # noqa: E501 - ack_id (str): Should be empty for the first call, acknowledges that the current batch of messages have been successfully received by the client. . [optional] # noqa: E501 - update_presence (bool): Whether to update the presence status of the account to AVAILABLE when calling the endpoint. Default value is true. . [optional] if omitted the server will use the default value of True # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V5EventsReadBody from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type"), + "tag": obj.get("tag"), + "eventTypes": obj.get("eventTypes"), + "scopes": obj.get("scopes"), + "ackId": obj.get("ackId"), + "updatePresence": obj.get("updatePresence") if obj.get("updatePresence") is not None else True + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = type - self.tag: str = tag - self.event_types: List[str] = None - self.ack_id: str = None - self.update_presence: bool = True - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/api_client.py b/symphony/bdk/gen/api_client.py index a691a812..ee9cfabb 100644 --- a/symphony/bdk/gen/api_client.py +++ b/symphony/bdk/gen/api_client.py @@ -1,44 +1,51 @@ +# coding: utf-8 + """ - Agent API + Symphony Profile Manager - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - A new authorizationToken has been introduced in the authenticationAPI response payload. It can be used to replace the sessionToken in any of the API calls and can be passed as \"Authorization\" header. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here:https://docs.developers.symphony.com/building-bots-on-symphony/messages/overview-of-messageml - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + Profile Manager is a microservice to manage users profile and groups - The version of the OpenAPI document: 20.14.0-SNAPSHOT - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import asyncio +import datetime +from dateutil.parser import parse +from enum import Enum +import decimal import json -import atexit import mimetypes -from multiprocessing.pool import ThreadPool -import io import os import re -import typing -from urllib.parse import quote + from urllib3.fields import RequestField +import tempfile + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr -from symphony.bdk.gen import rest from symphony.bdk.gen.configuration import Configuration -from symphony.bdk.gen.exceptions import ApiTypeError, ApiValueError, ApiException -from symphony.bdk.gen.model_utils import ( - ModelNormal, - ModelSimple, - ModelComposed, - check_allowed_values, - check_validations, - date, - datetime, - deserialize_file, - file_type, - model_to_dict, - none_type, - validate_and_convert_types +from symphony.bdk.gen.api_response import ApiResponse, T as ApiResponseT +import symphony.bdk.gen.models +from symphony.bdk.gen import rest +from symphony.bdk.gen.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException ) +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] -class ApiClient(object): +class ApiClient: """Generic API client for OpenAPI client library builds. OpenAPI generic API client. This client handles the client- @@ -46,28 +53,39 @@ class ApiClient(object): the methods and models for each application are generated from the OpenAPI templates. - NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - Do not edit the class manually. - :param configuration: .Configuration object for this client :param header_name: a header to pass when making calls to the API. :param header_value: a header value to pass when making calls to the API. :param cookie: a cookie to include in the header when making calls to the API - :param pool_threads: The number of threads to use for async requests - to the API. More threads means more concurrent API requests. """ + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'object': object, + } _pool = None - def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None, pool_threads=1): + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided if configuration is None: - configuration = Configuration() + configuration = Configuration.get_default() self.configuration = configuration - self.pool_threads = pool_threads self.rest_client = rest.RESTClientObject(configuration) self.default_headers = {} @@ -76,6 +94,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.cookie = cookie # Set default User-Agent. self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation async def __aenter__(self): return self @@ -85,22 +104,6 @@ async def __aexit__(self, exc_type, exc_value, traceback): async def close(self): await self.rest_client.close() - if self._pool: - self._pool.close() - self._pool.join() - self._pool = None - if hasattr(atexit, 'unregister'): - atexit.unregister(self.close) - - @property - def pool(self): - """Create thread pool on first request - avoids instantiating unused threadpool for blocking clients. - """ - if self._pool is None: - atexit.register(self.close) - self._pool = ThreadPool(self.pool_threads) - return self._pool @property def user_agent(self): @@ -114,26 +117,69 @@ def user_agent(self, value): def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value - async def __call_api( + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( self, - resource_path: str, - method: str, - path_params: typing.Optional[typing.Dict[str, typing.Any]] = None, - query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, - header_params: typing.Optional[typing.Dict[str, typing.Any]] = None, - body: typing.Optional[typing.Any] = None, - post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, - files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None, - response_type: typing.Optional[typing.Tuple[typing.Any]] = None, - auth_settings: typing.Optional[typing.List[str]] = None, - _return_http_data_only: typing.Optional[bool] = None, - collection_formats: typing.Optional[typing.Dict[str, str]] = None, - _preload_content: bool = True, - _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None, - _content_type: typing.Optional[str] = None - ): + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ config = self.configuration @@ -144,14 +190,17 @@ async def __call_api( header_params['Cookie'] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, - collection_formats)) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) # path parameters if path_params: path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, - collection_formats) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) for k, v in path_params: # specified safe chars, encode everything resource_path = resource_path.replace( @@ -159,78 +208,88 @@ async def __call_api( quote(str(v), safe=config.safe_chars_for_path_param) ) - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, - collection_formats) - # post parameters if post_params or files: post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, - collection_formats) - post_params.extend(self.files_parameters(files)) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) if header_params['Content-Type'].startswith("multipart"): post_params = self.parameters_to_multipart(post_params, - (dict) ) + (dict)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) # body if body: body = self.sanitize_for_serialization(body) - # auth setting - await self.update_params_for_auth(header_params, query_params, - auth_settings, resource_path, method, body) - # request url - if _host is None: + if _host is None or self.configuration.ignore_operation_servers: url = self.configuration.host + resource_path else: # use server/host defined in path or operation instead url = _host + resource_path - try: - # perform request and return response - response_data = await self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout) - except ApiException as e: - e.body = e.body.decode('utf-8') - raise e - - self.last_response = response_data + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query - return_data = response_data + return method, url, header_params, body, post_params - if not _preload_content: - return return_data - if response_type not in ["file", "bytes"]: - match = None - if _content_type is not None: - match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", _content_type) - encoding = match.group(1) if match else "utf-8" - response_data.data = response_data.data.decode(encoding) + async def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ - # deserialize response data - if response_type and response_data.status != 204: - return_data = self.deserialize( - response_data, - response_type, - _check_type + try: + # perform request and return response + response_data = await self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout ) - else: - return_data = None - if _return_http_data_only: - return return_data - else: - return (return_data, response_data.status, - response_data.getheaders()) + except ApiException as e: + raise e + + return response_data def parameters_to_multipart(self, params, collection_types): """Get parameters as list of tuples, formatting as json if value is collection_types @@ -254,235 +313,189 @@ def parameters_to_multipart(self, params, collection_types): new_params.append((k, v)) return new_params - @classmethod - def sanitize_for_serialization(cls, obj): + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # deserialize response data + response_text = None + return_data = None + try: + if response_type == "bytearray": + return_data = response_data.data + elif response_type == "file": + return_data = self.__deserialize_file(response_data) + elif response_type is not None: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data + ) + + def sanitize_for_serialization(self, obj): """Builds a JSON POST object. + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict. + :param obj: The data to serialize. :return: The serialized form of data. """ - if isinstance(obj, (ModelNormal, ModelComposed)): - return { - key: cls.sanitize_for_serialization(val) for key, val in model_to_dict(obj, serialize=True).items() - } - elif isinstance(obj, (str, int, float, none_type, bool)): + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): return obj - elif isinstance(obj, (datetime, date)): + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() - elif isinstance(obj, ModelSimple): - return cls.sanitize_for_serialization(obj.value) - elif isinstance(obj, (list, tuple)): - return [cls.sanitize_for_serialization(item) for item in obj] - if isinstance(obj, dict): - return {key: cls.sanitize_for_serialization(val) for key, val in obj.items()} - raise ApiValueError('Unable to prepare type {} for serialization'.format(obj.__class__.__name__)) - - def deserialize(self, response, response_type, _check_type): + elif isinstance(obj, decimal.Decimal): + return str(obj) + + elif isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + return { + key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items() + } + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): """Deserializes response into an object. :param response: RESTResponse object to be deserialized. - :param response_type: For the response, a tuple containing: - valid classes - a list containing valid classes (for list schemas) - a dict containing a tuple of valid classes as the value - Example values: - (str,) - (Pet,) - (float, none_type) - ([int, none_type],) - ({str: (bool, str, int, float, date, datetime, str, none_type)},) - :param _check_type: boolean, whether to check the types of the data - received from the server - :type _check_type: bool + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. :return: deserialized object. """ - # handle file downloading - # save response body into a tmp file and return the instance - if response_type == (file_type,): - content_disposition = response.getheader("Content-Disposition") - return deserialize_file(response.data, self.configuration, - content_disposition=content_disposition) # fetch data from response object - try: - received_data = json.loads(response.data) - except ValueError: - received_data = response.data - - # store our data under the key of 'received_data' so users have some - # context if they are deserializing a string and the data type is wrong - deserialized_data = validate_and_convert_types( - received_data, - response_type, - ['received_data'], - True, - _check_type, - configuration=self.configuration - ) - return deserialized_data + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif content_type.startswith("application/json"): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif content_type.startswith("text/plain"): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) - def call_api( - self, - resource_path: str, - method: str, - path_params: typing.Optional[typing.Dict[str, typing.Any]] = None, - query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, - header_params: typing.Optional[typing.Dict[str, typing.Any]] = None, - body: typing.Optional[typing.Any] = None, - post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, - files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None, - response_type: typing.Optional[typing.Tuple[typing.Any]] = None, - auth_settings: typing.Optional[typing.List[str]] = None, - async_req: typing.Optional[bool] = None, - _return_http_data_only: typing.Optional[bool] = None, - collection_formats: typing.Optional[typing.Dict[str, str]] = None, - _preload_content: bool = True, - _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, - _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None - ): - """Makes the HTTP request (synchronous) and returns deserialized data. - - To make an async_req request, set the async_req parameter. + return self.__deserialize(data, response_type) - :param resource_path: Path to method endpoint. - :param method: Method to call. - :param path_params: Path parameters in the url. - :param query_params: Query parameters in the url. - :param header_params: Header parameters to be - placed in the request header. - :param body: Request body. - :param post_params dict: Request post form parameters, - for `application/x-www-form-urlencoded`, `multipart/form-data`. - :param auth_settings list: Auth Settings names for the request. - :param response_type: For the response, a tuple containing: - valid classes - a list containing valid classes (for list schemas) - a dict containing a tuple of valid classes as the value - Example values: - (str,) - (Pet,) - (float, none_type) - ([int, none_type],) - ({str: (bool, str, int, float, date, datetime, str, none_type)},) - :param files: key -> field name, value -> a list of open file - objects for `multipart/form-data`. - :type files: dict - :param async_req bool: execute request asynchronously - :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param collection_formats: dict of collection formats for path, query, - header, and post parameters. - :type collection_formats: dict, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _check_type: boolean describing if the data back from the server - should have its type checked. - :type _check_type: bool, optional - :return: - If async_req parameter is True, - the request will be called asynchronously. - The method will return the request thread. - If parameter async_req is False or missing, - then the method will return the response directly. + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. """ - if not async_req: - return self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, files, - response_type, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host, - _check_type) - - return self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, - query_params, - header_params, body, - post_params, files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, _check_type)) - - def request(self, method, url, query_params=None, headers=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - """Makes the HTTP request using RESTClient.""" - if method == "GET": - return self.rest_client.GET(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "HEAD": - return self.rest_client.HEAD(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) - elif method == "OPTIONS": - return self.rest_client.OPTIONS(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "POST": - return self.rest_client.POST(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "PUT": - return self.rest_client.PUT(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "PATCH": - return self.rest_client.PATCH(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - elif method == "DELETE": - return self.rest_client.DELETE(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(symphony.bdk.gen.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datetime(data) + elif klass == decimal.Decimal: + return decimal.Decimal(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) else: - raise ApiValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." - ) + return self.__deserialize_model(data, klass) def parameters_to_tuples(self, params, collection_formats): """Get parameters as list of tuples, formatting collections. @@ -491,10 +504,10 @@ def parameters_to_tuples(self, params, collection_formats): :param dict collection_formats: Parameter collection formats :return: Parameters as list of tuples, collections formatted """ - new_params = [] + new_params: List[Tuple[str, str]] = [] if collection_formats is None: collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + for k, v in params.items() if isinstance(params, dict) else params: if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': @@ -514,344 +527,307 @@ def parameters_to_tuples(self, params, collection_formats): new_params.append((k, v)) return new_params - def files_parameters(self, files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None): - """Builds form parameters. + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. - :param files: None or a dict with key=param_name and - value is a list of open file objects - :return: List of tuples of form parameters with file data + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) """ - if files is None: - return [] + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) - params = [] - for param_name, file_instances in files.items(): - if file_instances is None: - # if the file field is nullable, skip None values - continue - for file_instance in file_instances: - if file_instance is None: - # if the file field is nullable, skip None values - continue - if file_instance.closed is True: - raise ApiValueError( - "Cannot read a closed file. The passed in file_type " - "for %s must be open." % param_name + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, str(value)) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v)) ) - filename = os.path.basename(file_instance.name) - filedata = file_instance.read() - mimetype = (mimetypes.guess_type(filename)[0] or - 'application/octet-stream') - params.append( - tuple([param_name, tuple([filename, filedata, mimetype])])) - file_instance.close() + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters(self, files: Dict[str, Union[str, bytes]]): + """Builds form parameters. + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) return params - def select_header_accept(self, accepts): + def select_header_accept(self, accepts: List[str]) -> Optional[str]: """Returns `Accept` based on an array of accepts provided. :param accepts: List of headers. :return: Accept (e.g. application/json). """ if not accepts: - return + return None - accepts = [x.lower() for x in accepts] + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept - if 'application/json' in accepts: - return 'application/json' - else: - return ', '.join(accepts) + return accepts[0] - def select_header_content_type(self, content_types, method=None, body=None): + def select_header_content_type(self, content_types): """Returns `Content-Type` based on an array of content_types provided. :param content_types: List of content-types. - :param method: http method (e.g. POST, PATCH). - :param body: http body to send. :return: Content-Type (e.g. application/json). """ if not content_types: - return 'application/json' - - content_types = [x.lower() for x in content_types] + return None - if (method == 'PATCH' and - 'application/json-patch+json' in content_types and - isinstance(body, list)): - return 'application/json-patch+json' + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type - if 'application/json' in content_types or '*/*' in content_types: - return 'application/json' - else: - return content_types[0] + return content_types[0] - async def update_params_for_auth(self, headers, queries, auth_settings, - resource_path, method, body): + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. :param queries: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. - :param resource_path: A string representation of the HTTP request resource path. - :param method: A string representation of the HTTP request method. - :param body: A object representing the body of the HTTP request. - The object type is the return value of _encoder.default(). + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return - for auth in auth_settings: - auth_setting = (await self.configuration.auth_settings()).get(auth) - if auth_setting: - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - queries.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + auth_settings_callable = self.configuration.auth_settings + # The auth_settings callable can be async, but this function is sync. + # We need to run the coroutine to get the result. This is a workaround + # for the generator producing mixed-style code. + if asyncio.iscoroutinefunction(auth_settings_callable): + try: + loop = asyncio.get_running_loop() + # This is a blocking call in an async context. It's not ideal, but it's + # necessary here to contain the change to this file. + auth_settings_dict = loop.run_until_complete(auth_settings_callable()) + except RuntimeError: # No running event loop + auth_settings_dict = asyncio.run(auth_settings_callable()) + else: + auth_settings_dict = auth_settings_callable() + for auth in auth_settings: + auth_setting = auth_settings_dict.get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting ) + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting -class Endpoint(object): - def __init__(self, settings=None, params_map=None, root_map=None, - headers_map=None, api_client=None, callable=None): - """Creates an endpoint - - Args: - settings (dict): see below key value pairs - 'response_type' (tuple/None): response type - 'auth' (list): a list of auth type keys - 'endpoint_path' (str): the endpoint path - 'operation_id' (str): endpoint string identifier - 'http_method' (str): POST/PUT/PATCH/GET etc - 'servers' (list): list of str servers that this endpoint is at - params_map (dict): see below key value pairs - 'all' (list): list of str endpoint parameter names - 'required' (list): list of required parameter names - 'nullable' (list): list of nullable parameter names - 'enum' (list): list of parameters with enum values - 'validation' (list): list of parameters with validations - root_map - 'validations' (dict): the dict mapping endpoint parameter tuple - paths to their validation dictionaries - 'allowed_values' (dict): the dict mapping endpoint parameter - tuple paths to their allowed_values (enum) dictionaries - 'openapi_types' (dict): param_name to openapi type - 'attribute_map' (dict): param_name to camelCase name - 'location_map' (dict): param_name to 'body', 'file', 'form', - 'header', 'path', 'query' - collection_format_map (dict): param_name to `csv` etc. - headers_map (dict): see below key value pairs - 'accept' (list): list of Accept header strings - 'content_type' (list): list of Content-Type header strings - api_client (ApiClient) api client instance - callable (function): the function which is invoked when the - Endpoint is called + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint """ - self.settings = settings - self.params_map = params_map - self.params_map['all'].extend([ - 'async_req', - '_host_index', - '_preload_content', - '_request_timeout', - '_return_http_data_only', - '_check_input_type', - '_check_return_type', - '_content_type', - '_spec_property_naming' - ]) - self.params_map['nullable'].extend(['_request_timeout']) - self.validations = root_map['validations'] - self.allowed_values = root_map['allowed_values'] - self.openapi_types = root_map['openapi_types'] - extra_types = { - 'async_req': (bool,), - '_host_index': (none_type, int), - '_preload_content': (bool,), - '_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]), - '_return_http_data_only': (bool,), - '_check_input_type': (bool,), - '_check_return_type': (bool,), - '_spec_property_naming': (bool,), - '_content_type': (none_type, str) - } - self.openapi_types.update(extra_types) - self.attribute_map = root_map['attribute_map'] - self.location_map = root_map['location_map'] - self.collection_format_map = root_map['collection_format_map'] - self.headers_map = headers_map - self.api_client = api_client - self.callable = callable - - def __validate_inputs(self, kwargs): - for param in self.params_map['enum']: - if param in kwargs: - check_allowed_values( - self.allowed_values, - (param,), - kwargs[param] - ) + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) - for param in self.params_map['validation']: - if param in kwargs: - check_validations( - self.validations, - (param,), - kwargs[param], - configuration=self.api_client.configuration - ) + def __deserialize_file(self, response): + """Deserializes body to file - if kwargs['_check_input_type'] is False: - return + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. - for key, value in kwargs.items(): - fixed_val = validate_and_convert_types( - value, - self.openapi_types[key], - [key], - kwargs['_spec_property_naming'], - kwargs['_check_input_type'], - configuration=self.api_client.configuration + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + m = re.search( + r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition ) - kwargs[key] = fixed_val - - def __gather_params(self, kwargs): - params = { - 'body': None, - 'collection_format': {}, - 'file': {}, - 'form': [], - 'header': {}, - 'path': {}, - 'query': [] - } + assert m is not None, "Unexpected 'content-disposition' header value" + filename = m.group(1) + path = os.path.join(os.path.dirname(path), filename) - for param_name, param_value in kwargs.items(): - param_location = self.location_map.get(param_name) - if param_location is None: - continue - if param_location: - if param_location == 'body': - params['body'] = param_value - continue - base_name = self.attribute_map[param_name] - if (param_location == 'form' and - self.openapi_types[param_name] == (file_type,)): - params['file'][base_name] = [param_value] - elif (param_location == 'form' and - self.openapi_types[param_name] == ([file_type],)): - # param_value is already a list - params['file'][base_name] = param_value - elif param_location in {'form', 'query'}: - param_value_full = (base_name, param_value) - params[param_location].append(param_value_full) - if param_location not in {'form', 'query'}: - params[param_location][base_name] = param_value - collection_format = self.collection_format_map.get(param_name) - if collection_format: - params['collection_format'][base_name] = collection_format + with open(path, "wb") as f: + f.write(response.data) - return params + return path - def __call__(self, *args, **kwargs): - """ This method is invoked when endpoints are called - Example: + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. - api_instance = AttachmentsApi() - api_instance.v1_stream_sid_attachment_get # this is an instance of the class Endpoint - api_instance.v1_stream_sid_attachment_get() # this invokes api_instance.v1_stream_sid_attachment_get.__call__() - which then invokes the callable functions stored in that endpoint at - api_instance.v1_stream_sid_attachment_get.callable or self.callable in this class + :param data: str. + :param klass: class literal. + :return: int, long, float, str, bool. """ - return self.callable(self, *args, **kwargs) + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data - def call_with_http_info(self, **kwargs): + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ try: - index = self.api_client.configuration.server_operation_index.get( - self.settings['operation_id'], self.api_client.configuration.server_index - ) if kwargs['_host_index'] is None else kwargs['_host_index'] - server_variables = self.api_client.configuration.server_operation_variables.get( - self.settings['operation_id'], self.api_client.configuration.server_variables - ) - _host = self.api_client.configuration.get_host_from_settings( - index, variables=server_variables, servers=self.settings['servers'] + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) ) - except IndexError: - if self.settings['servers']: - raise ApiValueError( - "Invalid host index. Must be 0 <= index < %s" % - len(self.settings['servers']) - ) - _host = None - - for key, value in kwargs.items(): - if key not in self.params_map['all']: - raise ApiTypeError( - "Got an unexpected parameter '%s'" - " to method `%s`" % - (key, self.settings['operation_id']) - ) - # only throw this nullable ApiValueError if _check_input_type - # is False, if _check_input_type==True we catch this case - # in self.__validate_inputs - if (key not in self.params_map['nullable'] and value is None - and kwargs['_check_input_type'] is False): - raise ApiValueError( - "Value may not be None for non-nullable parameter `%s`" - " when calling `%s`" % - (key, self.settings['operation_id']) - ) - for key in self.params_map['required']: - if key not in kwargs.keys(): - raise ApiValueError( - "Missing the required parameter `%s` when calling " - "`%s`" % (key, self.settings['operation_id']) + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. - self.__validate_inputs(kwargs) + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) - params = self.__gather_params(kwargs) + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. - accept_headers_list = self.headers_map['accept'] - if accept_headers_list: - params['header']['Accept'] = self.api_client.select_header_accept( - accept_headers_list) + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ - if kwargs.get('_content_type'): - params['header']['Content-Type'] = kwargs['_content_type'] - else: - content_type_headers_list = self.headers_map['content_type'] - if content_type_headers_list: - if params['body'] != "": - header_list = self.api_client.select_header_content_type( - content_type_headers_list, self.settings['http_method'], - params['body']) - params['header']['Content-Type'] = header_list - - return self.api_client.call_api( - self.settings['endpoint_path'], self.settings['http_method'], - params['path'], - params['query'], - params['header'], - body=params['body'], - post_params=params['form'], - files=params['file'], - response_type=self.settings['response_type'], - auth_settings=self.settings['auth'], - async_req=kwargs['async_req'], - _check_type=kwargs['_check_return_type'], - _return_http_data_only=kwargs['_return_http_data_only'], - _preload_content=kwargs['_preload_content'], - _request_timeout=kwargs['_request_timeout'], - _host=_host, - collection_formats=params['collection_format']) + return klass.from_dict(data) diff --git a/symphony/bdk/gen/api_response.py b/symphony/bdk/gen/api_response.py new file mode 100644 index 00000000..9bc7c11f --- /dev/null +++ b/symphony/bdk/gen/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/symphony/bdk/gen/auth_api/__init__.py b/symphony/bdk/gen/auth_api/__init__.py deleted file mode 100644 index 74c41b15..00000000 --- a/symphony/bdk/gen/auth_api/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# do not import all apis into this module because that uses a lot of memory and stack frames diff --git a/symphony/bdk/gen/auth_api/authentication_api.py b/symphony/bdk/gen/auth_api/authentication_api.py deleted file mode 100644 index 42605011..00000000 --- a/symphony/bdk/gen/auth_api/authentication_api.py +++ /dev/null @@ -1,164 +0,0 @@ -""" - Authenticator API - - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 - - The version of the OpenAPI document: 20.10.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.auth_model.error import Error -from symphony.bdk.gen.auth_model.obo_auth_response import OboAuthResponse - - -class AuthenticationApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient() - self.api_client = api_client - - def __v1_app_username_username_authenticate_post( - self, - username, - session_token, - **kwargs - ): - """PROVISIONAL - Authenicate an application in a delegated context to act on behalf of a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = auth_api.v1_app_username_username_authenticate_post(username, session_token, async_req=True) - >>> result = thread.get() - - Args: - username (str): username - session_token (str): Authorization token obtains from app/authenicate API - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (float/tuple): timeout setting for this request. If one - number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - OboAuthResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['username'] = \ - username - kwargs['session_token'] = \ - session_token - return self.call_with_http_info(**kwargs) - - self.v1_app_username_username_authenticate_post = Endpoint( - settings={ - 'response_type': (OboAuthResponse,), - 'auth': [], - 'endpoint_path': '/v1/app/username/{username}/authenticate', - 'operation_id': 'v1_app_username_username_authenticate_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'username', - 'session_token', - ], - 'required': [ - 'username', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'username': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'username': 'username', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'username': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client, - callable=__v1_app_username_username_authenticate_post - ) diff --git a/symphony/bdk/gen/auth_api/certificate_authentication_api.py b/symphony/bdk/gen/auth_api/certificate_authentication_api.py index acb3ae66..1778e01f 100644 --- a/symphony/bdk/gen/auth_api/certificate_authentication_api.py +++ b/symphony/bdk/gen/auth_api/certificate_authentication_api.py @@ -1,800 +1,1672 @@ +# coding: utf-8 + """ Authenticator API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.auth_model.error import Error +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt, StrictStr +from typing_extensions import Annotated from symphony.bdk.gen.auth_model.extension_app_authenticate_request import ExtensionAppAuthenticateRequest from symphony.bdk.gen.auth_model.extension_app_tokens import ExtensionAppTokens from symphony.bdk.gen.auth_model.obo_auth_response import OboAuthResponse from symphony.bdk.gen.auth_model.success_response import SuccessResponse from symphony.bdk.gen.auth_model.token import Token +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class CertificateAuthenticationApi(object): +class CertificateAuthenticationApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_app_authenticate_post_endpoint = _Endpoint( - settings={ - 'response_type': (Token,), - 'auth': [], - 'endpoint_path': '/v1/app/authenticate', - 'operation_id': 'v1_app_authenticate_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - }, - 'attribute_map': { - }, - 'location_map': { - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_app_user_uid_authenticate_post_endpoint = _Endpoint( - settings={ - 'response_type': (OboAuthResponse,), - 'auth': [], - 'endpoint_path': '/v1/app/user/{uid}/authenticate', - 'operation_id': 'v1_app_user_uid_authenticate_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'uid', - 'session_token', - ], - 'required': [ - 'uid', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'uid': - (int,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'uid': 'uid', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'uid': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + + + @validate_call + async def v1_app_authenticate_post( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Token: + """(Deprecated - use RSA authentication instead /login/v1/pubkey/app/authenticate) PROVISIONAL - Authenticate an application in a delegated context. + + Based on the SSL client certificate presented by the TLS layer, authenticate the API caller and return an application session. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_authenticate_post_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_app_authenticate_post_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Token]: + """(Deprecated - use RSA authentication instead /login/v1/pubkey/app/authenticate) PROVISIONAL - Authenticate an application in a delegated context. + + Based on the SSL client certificate presented by the TLS layer, authenticate the API caller and return an application session. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_authenticate_post_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_app_authenticate_post_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated - use RSA authentication instead /login/v1/pubkey/app/authenticate) PROVISIONAL - Authenticate an application in a delegated context. + + Based on the SSL client certificate presented by the TLS layer, authenticate the API caller and return an application session. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_authenticate_post_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_app_authenticate_post_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_app_username_username_authenticate_post_endpoint = _Endpoint( - settings={ - 'response_type': (OboAuthResponse,), - 'auth': [], - 'endpoint_path': '/v1/app/username/{username}/authenticate', - 'operation_id': 'v1_app_username_username_authenticate_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'username', - 'session_token', - ], - 'required': [ - 'username', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'username': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'username': 'username', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'username': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/app/authenticate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_app_user_uid_authenticate_post( + self, + uid: Annotated[StrictInt, Field(description="user id")], + session_token: Annotated[StrictStr, Field(description="Authorization token obtains from app/authenicate API")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OboAuthResponse: + """(Deprecated - use RSA authentication instead /login/v1/app/user/{uid}/authenticate) PROVISIONAL - Authenticate an application in a delegated context to act on behalf of a user + + + :param uid: user id (required) + :type uid: int + :param session_token: Authorization token obtains from app/authenicate API (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_user_uid_authenticate_post_serialize( + uid=uid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OboAuthResponse", + '400': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_app_user_uid_authenticate_post_with_http_info( + self, + uid: Annotated[StrictInt, Field(description="user id")], + session_token: Annotated[StrictStr, Field(description="Authorization token obtains from app/authenicate API")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OboAuthResponse]: + """(Deprecated - use RSA authentication instead /login/v1/app/user/{uid}/authenticate) PROVISIONAL - Authenticate an application in a delegated context to act on behalf of a user + + + :param uid: user id (required) + :type uid: int + :param session_token: Authorization token obtains from app/authenicate API (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_user_uid_authenticate_post_serialize( + uid=uid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OboAuthResponse", + '400': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_app_user_uid_authenticate_post_without_preload_content( + self, + uid: Annotated[StrictInt, Field(description="user id")], + session_token: Annotated[StrictStr, Field(description="Authorization token obtains from app/authenicate API")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated - use RSA authentication instead /login/v1/app/user/{uid}/authenticate) PROVISIONAL - Authenticate an application in a delegated context to act on behalf of a user + + + :param uid: user id (required) + :type uid: int + :param session_token: Authorization token obtains from app/authenicate API (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_user_uid_authenticate_post_serialize( + uid=uid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OboAuthResponse", + '400': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_app_user_uid_authenticate_post_serialize( + self, + uid, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_authenticate_extension_app_post_endpoint = _Endpoint( - settings={ - 'response_type': (ExtensionAppTokens,), - 'auth': [], - 'endpoint_path': '/v1/authenticate/extensionApp', - 'operation_id': 'v1_authenticate_extension_app_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'auth_request', - ], - 'required': [ - 'auth_request', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'auth_request': - (ExtensionAppAuthenticateRequest,), - }, - 'attribute_map': { - }, - 'location_map': { - 'auth_request': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/app/user/{uid}/authenticate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_app_username_username_authenticate_post( + self, + username: Annotated[StrictStr, Field(description="username")], + session_token: Annotated[StrictStr, Field(description="Authorization token obtains from app/authenicate API")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OboAuthResponse: + """(Deprecated - use RSA authentication instead /login/v1/app/username/{username}/authenticate) PROVISIONAL - Authenticate an application in a delegated context to act on behalf of a user + + + :param username: username (required) + :type username: str + :param session_token: Authorization token obtains from app/authenicate API (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_username_username_authenticate_post_serialize( + username=username, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OboAuthResponse", + '400': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_app_username_username_authenticate_post_with_http_info( + self, + username: Annotated[StrictStr, Field(description="username")], + session_token: Annotated[StrictStr, Field(description="Authorization token obtains from app/authenicate API")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OboAuthResponse]: + """(Deprecated - use RSA authentication instead /login/v1/app/username/{username}/authenticate) PROVISIONAL - Authenticate an application in a delegated context to act on behalf of a user + + + :param username: username (required) + :type username: str + :param session_token: Authorization token obtains from app/authenicate API (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_username_username_authenticate_post_serialize( + username=username, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OboAuthResponse", + '400': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_app_username_username_authenticate_post_without_preload_content( + self, + username: Annotated[StrictStr, Field(description="username")], + session_token: Annotated[StrictStr, Field(description="Authorization token obtains from app/authenicate API")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated - use RSA authentication instead /login/v1/app/username/{username}/authenticate) PROVISIONAL - Authenticate an application in a delegated context to act on behalf of a user + + + :param username: username (required) + :type username: str + :param session_token: Authorization token obtains from app/authenicate API (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_username_username_authenticate_post_serialize( + username=username, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OboAuthResponse", + '400': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_app_username_username_authenticate_post_serialize( + self, + username, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if username is not None: + _path_params['username'] = username + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' ] - }, - api_client=api_client - ) - self.v1_authenticate_post_endpoint = _Endpoint( - settings={ - 'response_type': (Token,), - 'auth': [], - 'endpoint_path': '/v1/authenticate', - 'operation_id': 'v1_authenticate_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - }, - 'attribute_map': { - }, - 'location_map': { - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/app/username/{username}/authenticate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_authenticate_extension_app_post( + self, + auth_request: Annotated[ExtensionAppAuthenticateRequest, Field(description="application generated token")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ExtensionAppTokens: + """(Deprecated - use RSA authentication instead /login/v1/pubkey/app/authenticate/extensionApp) Authenticate a client-extension application + + Based on the application's SSL client certificate presented by the TLS layer, it authenticates the client-extension application and return a symphony verification token. + + :param auth_request: application generated token (required) + :type auth_request: ExtensionAppAuthenticateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_authenticate_extension_app_post_serialize( + auth_request=auth_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExtensionAppTokens", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_authenticate_extension_app_post_with_http_info( + self, + auth_request: Annotated[ExtensionAppAuthenticateRequest, Field(description="application generated token")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ExtensionAppTokens]: + """(Deprecated - use RSA authentication instead /login/v1/pubkey/app/authenticate/extensionApp) Authenticate a client-extension application + + Based on the application's SSL client certificate presented by the TLS layer, it authenticates the client-extension application and return a symphony verification token. + + :param auth_request: application generated token (required) + :type auth_request: ExtensionAppAuthenticateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_authenticate_extension_app_post_serialize( + auth_request=auth_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExtensionAppTokens", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_authenticate_extension_app_post_without_preload_content( + self, + auth_request: Annotated[ExtensionAppAuthenticateRequest, Field(description="application generated token")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated - use RSA authentication instead /login/v1/pubkey/app/authenticate/extensionApp) Authenticate a client-extension application + + Based on the application's SSL client certificate presented by the TLS layer, it authenticates the client-extension application and return a symphony verification token. + + :param auth_request: application generated token (required) + :type auth_request: ExtensionAppAuthenticateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_authenticate_extension_app_post_serialize( + auth_request=auth_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExtensionAppTokens", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_authenticate_extension_app_post_serialize( + self, + auth_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if auth_request is not None: + _body_params = auth_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_logout_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/logout', - 'operation_id': 'v1_logout_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/authenticate/extensionApp', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def v1_app_authenticate_post( + + + + @validate_call + async def v1_authenticate_post( self, - **kwargs - ): - """(Deprecated - use RSA authentication instead /login/v1/pubkey/app/authenticate) PROVISIONAL - Authenticate an application in a delegated context. # noqa: E501 - - Based on the SSL client certificate presented by the TLS layer, authenticate the API caller and return an application session. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = auth_api.v1_app_authenticate_post(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Token - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.v1_app_authenticate_post_endpoint.call_with_http_info(**kwargs) - - def v1_app_user_uid_authenticate_post( + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Token: + """Authenticate. + + Based on the SSL client certificate presented by the TLS layer, authenticate the API caller and return a session token. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_authenticate_post_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_authenticate_post_with_http_info( self, - uid, - session_token, - **kwargs - ): - """(Deprecated - use RSA authentication instead /login/v1/app/user/{uid}/authenticate) PROVISIONAL - Authenticate an application in a delegated context to act on behalf of a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = auth_api.v1_app_user_uid_authenticate_post(uid, session_token, async_req=True) - >>> result = thread.get() - - Args: - uid (int): user id - session_token (str): Authorization token obtains from app/authenicate API - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - OboAuthResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['uid'] = \ - uid - kwargs['session_token'] = \ - session_token - return self.v1_app_user_uid_authenticate_post_endpoint.call_with_http_info(**kwargs) - - def v1_app_username_username_authenticate_post( + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Token]: + """Authenticate. + + Based on the SSL client certificate presented by the TLS layer, authenticate the API caller and return a session token. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_authenticate_post_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_authenticate_post_without_preload_content( self, - username, - session_token, - **kwargs - ): - """(Deprecated - use RSA authentication instead /login/v1/app/username/{username}/authenticate) PROVISIONAL - Authenticate an application in a delegated context to act on behalf of a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = auth_api.v1_app_username_username_authenticate_post(username, session_token, async_req=True) - >>> result = thread.get() - - Args: - username (str): username - session_token (str): Authorization token obtains from app/authenicate API - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - OboAuthResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['username'] = \ - username - kwargs['session_token'] = \ - session_token - return self.v1_app_username_username_authenticate_post_endpoint.call_with_http_info(**kwargs) - - def v1_authenticate_extension_app_post( + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Authenticate. + + Based on the SSL client certificate presented by the TLS layer, authenticate the API caller and return a session token. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_authenticate_post_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_authenticate_post_serialize( self, - auth_request, - **kwargs - ): - """(Deprecated - use RSA authentication instead /login/v1/pubkey/app/authenticate/extensionApp) Authenticate a client-extension application # noqa: E501 - - Based on the application's SSL client certificate presented by the TLS layer, it authenticates the client-extension application and return a symphony verification token. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = auth_api.v1_authenticate_extension_app_post(auth_request, async_req=True) - >>> result = thread.get() - - Args: - auth_request (ExtensionAppAuthenticateRequest): application generated token - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ExtensionAppTokens - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['auth_request'] = \ - auth_request - return self.v1_authenticate_extension_app_post_endpoint.call_with_http_info(**kwargs) - - def v1_authenticate_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/authenticate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_logout_post( + self, + session_token: Annotated[StrictStr, Field(description="the session token to logout.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Logout. + + Logout a users session. + + :param session_token: the session token to logout. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_logout_post_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_logout_post_with_http_info( self, - **kwargs - ): - """Authenticate. # noqa: E501 - - Based on the SSL client certificate presented by the TLS layer, authenticate the API caller and return a session token. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = auth_api.v1_authenticate_post(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Token - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.v1_authenticate_post_endpoint.call_with_http_info(**kwargs) - - def v1_logout_post( + session_token: Annotated[StrictStr, Field(description="the session token to logout.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Logout. + + Logout a users session. + + :param session_token: the session token to logout. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_logout_post_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_logout_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="the session token to logout.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Logout. + + Logout a users session. + + :param session_token: the session token to logout. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_logout_post_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_logout_post_serialize( self, session_token, - **kwargs - ): - """Logout. # noqa: E501 - - Logout a users session. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = auth_api.v1_logout_post(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): the session token to logout. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_logout_post_endpoint.call_with_http_info(**kwargs) + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/logout', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/auth_api/certificate_pod_api.py b/symphony/bdk/gen/auth_api/certificate_pod_api.py index 92ae6b9f..bb5114b3 100644 --- a/symphony/bdk/gen/auth_api/certificate_pod_api.py +++ b/symphony/bdk/gen/auth_api/certificate_pod_api.py @@ -1,153 +1,284 @@ +# coding: utf-8 + """ Authenticator API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.auth_model.error import Error from symphony.bdk.gen.auth_model.pod_certificate import PodCertificate +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class CertificatePodApi(object): +class CertificatePodApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_app_pod_certificate_get_endpoint = _Endpoint( - settings={ - 'response_type': (PodCertificate,), - 'auth': [], - 'endpoint_path': '/v1/app/pod/certificate', - 'operation_id': 'v1_app_pod_certificate_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - }, - 'attribute_map': { - }, - 'location_map': { - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - def v1_app_pod_certificate_get( + + @validate_call + async def v1_app_pod_certificate_get( self, - **kwargs - ): - """Retrieve the certificate that can be use to validate the JWT token obtain through the extension application authentication flow. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = auth_api.v1_app_pod_certificate_get(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - PodCertificate - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PodCertificate: + """Retrieve the certificate that can be use to validate the JWT token obtain through the extension application authentication flow. + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_pod_certificate_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PodCertificate", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_app_pod_certificate_get_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PodCertificate]: + """Retrieve the certificate that can be use to validate the JWT token obtain through the extension application authentication flow. + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_pod_certificate_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PodCertificate", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_app_pod_certificate_get_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the certificate that can be use to validate the JWT token obtain through the extension application authentication flow. + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_app_pod_certificate_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PodCertificate", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.v1_app_pod_certificate_get_endpoint.call_with_http_info(**kwargs) + return response_data.response + + + def _v1_app_pod_certificate_get_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/app/pod/certificate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/auth_model/__init__.py b/symphony/bdk/gen/auth_model/__init__.py deleted file mode 100644 index a14105e9..00000000 --- a/symphony/bdk/gen/auth_model/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# do not import all models into this module because that uses a lot of memory and stack frames diff --git a/symphony/bdk/gen/auth_model/error.py b/symphony/bdk/gen/auth_model/error.py index 54539a61..0c4a243f 100644 --- a/symphony/bdk/gen/auth_model/error.py +++ b/symphony/bdk/gen/auth_model/error.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Authenticator API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Error(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'code': (int, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Error(BaseModel): + """ + Error + """ # noqa: E501 + code: Optional[StrictInt] = None + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["code", "message"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'code': 'code', # noqa: E501 - 'message': 'message', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Error - a auth_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - code (int): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Error from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Error - a auth_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - code (int): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Error from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.code: int = None - self.message: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/auth_model/extension_app_authenticate_request.py b/symphony/bdk/gen/auth_model/extension_app_authenticate_request.py index b73e127f..9a8af519 100644 --- a/symphony/bdk/gen/auth_model/extension_app_authenticate_request.py +++ b/symphony/bdk/gen/auth_model/extension_app_authenticate_request.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Authenticator API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class ExtensionAppAuthenticateRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'app_token': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class ExtensionAppAuthenticateRequest(BaseModel): + """ + Request body for extension app authentication + """ # noqa: E501 + app_token: Optional[StrictStr] = Field(default=None, description="application generated token", alias="appToken") + __properties: ClassVar[List[str]] = ["appToken"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'app_token': 'appToken', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ExtensionAppAuthenticateRequest - a auth_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_token (str): application generated token. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExtensionAppAuthenticateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ExtensionAppAuthenticateRequest - a auth_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_token (str): application generated token. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExtensionAppAuthenticateRequest from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "appToken": obj.get("appToken") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.app_token: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/auth_model/extension_app_tokens.py b/symphony/bdk/gen/auth_model/extension_app_tokens.py index 85650362..fce5de3c 100644 --- a/symphony/bdk/gen/auth_model/extension_app_tokens.py +++ b/symphony/bdk/gen/auth_model/extension_app_tokens.py @@ -1,271 +1,93 @@ +# coding: utf-8 + """ Authenticator API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class ExtensionAppTokens(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ExtensionAppTokens(BaseModel): """ + ExtensionAppTokens + """ # noqa: E501 + app_id: Optional[StrictStr] = Field(default=None, description="Application ID", alias="appId") + app_token: Optional[StrictStr] = Field(default=None, description="This token generated by the application when calling authentication endpoint ", alias="appToken") + symphony_token: Optional[StrictStr] = Field(default=None, description="This token generated by Symphony and should be used by the application to verify that it's talking to Symphony. ", alias="symphonyToken") + expire_at: Optional[StrictInt] = Field(default=None, description="unix timestamp when the token expired", alias="expireAt") + __properties: ClassVar[List[str]] = ["appId", "appToken", "symphonyToken", "expireAt"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExtensionAppTokens from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'app_id': (str, none_type), # noqa: E501 - 'app_token': (str, none_type), # noqa: E501 - 'symphony_token': (str, none_type), # noqa: E501 - 'expire_at': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'app_id': 'appId', # noqa: E501 - 'app_token': 'appToken', # noqa: E501 - 'symphony_token': 'symphonyToken', # noqa: E501 - 'expire_at': 'expireAt', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ExtensionAppTokens - a auth_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_id (str): Application ID. [optional] # noqa: E501 - app_token (str): This token generated by the application when calling authentication endpoint . [optional] # noqa: E501 - symphony_token (str): This token generated by Symphony and should be used by the application to verify that it's talking to Symphony. . [optional] # noqa: E501 - expire_at (int): unix timestamp when the token expired. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ExtensionAppTokens - a auth_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_id (str): Application ID. [optional] # noqa: E501 - app_token (str): This token generated by the application when calling authentication endpoint . [optional] # noqa: E501 - symphony_token (str): This token generated by Symphony and should be used by the application to verify that it's talking to Symphony. . [optional] # noqa: E501 - expire_at (int): unix timestamp when the token expired. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExtensionAppTokens from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "appId": obj.get("appId"), + "appToken": obj.get("appToken"), + "symphonyToken": obj.get("symphonyToken"), + "expireAt": obj.get("expireAt") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.app_id: str = None - self.app_token: str = None - self.symphony_token: str = None - self.expire_at: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/auth_model/obo_auth_response.py b/symphony/bdk/gen/auth_model/obo_auth_response.py index 9db54ba9..56c330b1 100644 --- a/symphony/bdk/gen/auth_model/obo_auth_response.py +++ b/symphony/bdk/gen/auth_model/obo_auth_response.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Authenticator API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class OboAuthResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'session_token': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class OboAuthResponse(BaseModel): + """ + OboAuthResponse + """ # noqa: E501 + session_token: Optional[StrictStr] = Field(default=None, description="The token which should be passed. This should be considered opaque data by the client. It is not intended to contain any data interpretable by the client. The format is secret and subject to change without notice. ", alias="sessionToken") + __properties: ClassVar[List[str]] = ["sessionToken"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'session_token': 'sessionToken', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """OboAuthResponse - a auth_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - session_token (str): The token which should be passed. This should be considered opaque data by the client. It is not intended to contain any data interpretable by the client. The format is secret and subject to change without notice. . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OboAuthResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """OboAuthResponse - a auth_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - session_token (str): The token which should be passed. This should be considered opaque data by the client. It is not intended to contain any data interpretable by the client. The format is secret and subject to change without notice. . [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OboAuthResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "sessionToken": obj.get("sessionToken") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.session_token: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/auth_model/pod_certificate.py b/symphony/bdk/gen/auth_model/pod_certificate.py index cd70cd37..ad921c25 100644 --- a/symphony/bdk/gen/auth_model/pod_certificate.py +++ b/symphony/bdk/gen/auth_model/pod_certificate.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Authenticator API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class PodCertificate(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'certificate': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class PodCertificate(BaseModel): + """ + PodCertificate + """ # noqa: E501 + certificate: Optional[StrictStr] = Field(default=None, description="Certificate in PEM format") + __properties: ClassVar[List[str]] = ["certificate"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'certificate': 'certificate', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """PodCertificate - a auth_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - certificate (str): Certificate in PEM format. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PodCertificate from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """PodCertificate - a auth_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - certificate (str): Certificate in PEM format. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PodCertificate from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "certificate": obj.get("certificate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.certificate: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/auth_model/success_response.py b/symphony/bdk/gen/auth_model/success_response.py index f902fde0..1007c9d7 100644 --- a/symphony/bdk/gen/auth_model/success_response.py +++ b/symphony/bdk/gen/auth_model/success_response.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Authenticator API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class SuccessResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class SuccessResponse(BaseModel): + """ + SuccessResponse + """ # noqa: E501 + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["message"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'message': 'message', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """SuccessResponse - a auth_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SuccessResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """SuccessResponse - a auth_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SuccessResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "message": obj.get("message") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/auth_model/token.py b/symphony/bdk/gen/auth_model/token.py index 3897660e..8428b599 100644 --- a/symphony/bdk/gen/auth_model/token.py +++ b/symphony/bdk/gen/auth_model/token.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Authenticator API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Connections to the servers will be over client authenticated TLS, the servers for this API will perform the authentication by inspecting the certificate presented by the SSLSocketClient. There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Token(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a auth_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str, none_type), # noqa: E501 - 'token': (str, none_type), # noqa: E501 - 'authorization_token': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Token(BaseModel): + """ + Token + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="The name of the header in which the token should be presented on subsequent API calls. ") + token: Optional[StrictStr] = Field(default=None, description="Authentication token that should be passed as header in each API rest calls. This should be considered opaque data by the client. It is not intended to contain any data interpretable by the client. The format is secret and subject to change without notice. ") + authorization_token: Optional[StrictStr] = Field(default=None, description="(Beta) Short lived access token built from a user session. This field is still on Beta, please continue using the returned \"token\" instead. ", alias="authorizationToken") + __properties: ClassVar[List[str]] = ["name", "token", "authorizationToken"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'name': 'name', # noqa: E501 - 'token': 'token', # noqa: E501 - 'authorization_token': 'authorizationToken', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Token - a auth_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): The name of the header in which the token should be presented on subsequent API calls. . [optional] # noqa: E501 - token (str): Authentication token that should be passed as header in each API rest calls. This should be considered opaque data by the client. It is not intended to contain any data interpretable by the client. The format is secret and subject to change without notice. . [optional] # noqa: E501 - authorization_token (str): (Beta) Short lived access token built from a user session. This field is still on Beta, please continue using the returned \"token\" instead. . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Token from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Token - a auth_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the auth_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): The name of the header in which the token should be presented on subsequent API calls. . [optional] # noqa: E501 - token (str): Authentication token that should be passed as header in each API rest calls. This should be considered opaque data by the client. It is not intended to contain any data interpretable by the client. The format is secret and subject to change without notice. . [optional] # noqa: E501 - authorization_token (str): (Beta) Short lived access token built from a user session. This field is still on Beta, please continue using the returned \"token\" instead. . [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Token from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "token": obj.get("token"), + "authorizationToken": obj.get("authorizationToken") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.token: str = None - self.authorization_token: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/configuration.py b/symphony/bdk/gen/configuration.py index 22da746c..156c9635 100644 --- a/symphony/bdk/gen/configuration.py +++ b/symphony/bdk/gen/configuration.py @@ -1,21 +1,26 @@ +# coding: utf-8 + """ - Agent API + Symphony Profile Manager - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - A new authorizationToken has been introduced in the authenticationAPI response payload. It can be used to replace the sessionToken in any of the API calls and can be passed as \"Authorization\" header. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://docs.developers.symphony.com/building-bots-on-symphony/messages/overview-of-messageml - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + Profile Manager is a microservice to manage users profile and groups - The version of the OpenAPI document: 20.14.0-SNAPSHOT - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 import copy +import http.client as httplib import logging -import multiprocessing +from logging import FileHandler import sys -import urllib3 +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from typing_extensions import NotRequired, Self -from http import client as http_client -from symphony.bdk.gen.exceptions import ApiValueError +import urllib3 JSON_SCHEMA_VALIDATION_KEYWORDS = { @@ -24,46 +29,124 @@ 'minLength', 'pattern', 'maxItems', 'minItems' } -class Configuration(object): - """NOTE: This class is auto generated by OpenAPI Generator - - Ref: https://openapi-generator.tech - Do not edit the class manually. - - :param host: Base url +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + "bearerAuth": BearerFormatAuthSetting, + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. :param api_key: Dict to store API key(s). Each entry in the dict specifies an API key. The dict key is the name of the security scheme in the OAS specification. The dict value is the API key secret. - :param api_key_prefix: Dict to store API prefix (e.g. Bearer) + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). The dict key is the name of the security scheme in the OAS specification. The dict value is an API key prefix when generating the auth data. - :param username: Username for HTTP basic authentication - :param password: Password for HTTP basic authentication - :param discard_unknown_keys: Boolean value indicating whether to discard - unknown properties. A server may send a response that includes additional - properties that are not known by the client in the following scenarios: - 1. The OpenAPI document is incomplete, i.e. it does not match the server - implementation. - 2. The client was generated using an older version of the OpenAPI document - and the server has been upgraded since then. - If a schema in the OpenAPI document defines the additionalProperties attribute, - then all undeclared properties received by the server are injected into the - additional properties map. In that case, there are undeclared properties, and - nothing to discard. - :param disabled_client_side_validations (string): Comma-separated list of - JSON schema validation keywords to disable JSON schema structural validation - rules. The following keywords may be specified: multipleOf, maximum, - exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern, - maxItems, minItems. - By default, the validation is performed for data generated locally by the client - and data received from the server, independent of any validation performed by - the server side. If the input data does not satisfy the JSON schema validation - rules specified in the OpenAPI document, an exception is raised. - If disabled_client_side_validations is set, structural validation is - disabled. This can be useful to troubleshoot data validation problem, such as - when the OpenAPI document validation rules do not match the actual API data - received by the server. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. :param server_index: Index to servers configuration. :param server_variables: Mapping with string values to replace variables in templated server configuration. The validation of enums is performed for @@ -72,27 +155,41 @@ class Configuration(object): configuration. :param server_operation_variables: Mapping from operation ID to a mapping with string values to replace variables in templated server configuration. - The validation of enums is performed for variables with defined enum values before. + The validation of enums is performed for variables with defined enum + values before. :param ssl_ca_cert: str - the path to a file of concatenated CA certificates - in PEM format + in PEM format. + :param retries: Number of retries for API requests. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :Example: """ - _default = None - - def __init__(self, host=None, - api_key=None, api_key_prefix=None, - access_token=None, - username=None, password=None, - discard_unknown_keys=False, - disabled_client_side_validations="", - server_index=None, server_variables=None, - server_operation_index=None, server_operation_variables=None, - ssl_ca_cert=None, - ): + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[int] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + *, + debug: Optional[bool] = None, + ) -> None: """Constructor """ - self._base_path = "http://localhost" if host is None else host + self._base_path = "http://localhost/profile-manager" if host is None else host """Default Base url """ self.server_index = 0 if server_index is None and host is None else server_index @@ -103,11 +200,13 @@ def __init__(self, host=None, self.server_operation_variables = server_operation_variables or {} """Default server variables """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ self.temp_folder_path = None """Temp file folder for downloading files """ # Authentication Settings - self.access_token = access_token self.api_key = {} if api_key: self.api_key = api_key @@ -127,8 +226,9 @@ def __init__(self, host=None, self.password = password """Password for HTTP basic authentication """ - self.discard_unknown_keys = discard_unknown_keys - self.disabled_client_side_validations = disabled_client_side_validations + self.access_token = access_token + """Access token + """ self.logger = {} """Logging Settings """ @@ -140,13 +240,16 @@ def __init__(self, host=None, self.logger_stream_handler = None """Log stream handler """ - self.logger_file_handler = None + self.logger_file_handler: Optional[FileHandler] = None """Log file handler """ self.logger_file = None """Debug file location """ - self.debug = False + if debug is not None: + self.debug = debug + else: + self.__debug = False """Debug switch """ @@ -158,6 +261,10 @@ def __init__(self, host=None, self.ssl_ca_cert = ssl_ca_cert """Set this to customize the certificate file to verify the peer. """ + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ self.cert_file = None """client certificate file """ @@ -167,37 +274,44 @@ def __init__(self, host=None, self.assert_hostname = None """Set this to True/False to enable/disable SSL hostname verification. """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 - """urllib3 connection pool's maximum number of connections saved - per pool. urllib3 uses 1 connection as default value, but this is - not the best value when you are making a lot of possibly parallel - requests to the same host, which is often the case here. - cpu_count * 5 is used as default value to increase performance. + self.connection_pool_maxsize = 100 + """This value is passed to the aiohttp to limit simultaneous connections. + Default values is 100, None means no-limit. """ - self.proxy = None + self.proxy: Optional[str] = None """Proxy URL """ - self.no_proxy = None - """bypass proxy for host in the no_proxy list. - """ self.proxy_headers = None """Proxy headers """ self.safe_chars_for_path_param = '' """Safe chars for path_param """ - self.retries = None + self.retries = retries """Adding retries to override urllib3 default value 3 """ # Enable client side validation self.client_side_validation = True - # Options to pass down to the underlying urllib3 socket self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ - def __deepcopy__(self, memo): + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: cls = self.__class__ result = cls.__new__(cls) memo[id(self)] = result @@ -211,18 +325,11 @@ def __deepcopy__(self, memo): result.debug = self.debug return result - def __setattr__(self, name, value): + def __setattr__(self, name: str, value: Any) -> None: object.__setattr__(self, name, value) - if name == 'disabled_client_side_validations': - s = set(filter(None, value.split(','))) - for v in s: - if v not in JSON_SCHEMA_VALIDATION_KEYWORDS: - raise ApiValueError( - "Invalid keyword: '{0}''".format(v)) - self._disabled_client_side_validations = s @classmethod - def set_default(cls, default): + def set_default(cls, default: Optional[Self]) -> None: """Set default instance of configuration. It stores default configuration, which can be @@ -230,24 +337,34 @@ def set_default(cls, default): :param default: object of Configuration """ - cls._default = copy.deepcopy(default) + cls._default = default @classmethod - def get_default_copy(cls): - """Return new instance of configuration. + def get_default_copy(cls) -> Self: + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls) -> Self: + """Return the default configuration. This method returns newly created, based on default constructor, object of Configuration class or returns a copy of default - configuration passed by the set_default method. + configuration. :return: The configuration object. """ - if cls._default is not None: - return copy.deepcopy(cls._default) - return Configuration() + if cls._default is None: + cls._default = cls() + return cls._default @property - def logger_file(self): + def logger_file(self) -> Optional[str]: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -259,7 +376,7 @@ def logger_file(self): return self.__logger_file @logger_file.setter - def logger_file(self, value): + def logger_file(self, value: Optional[str]) -> None: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -278,7 +395,7 @@ def logger_file(self, value): logger.addHandler(self.logger_file_handler) @property - def debug(self): + def debug(self) -> bool: """Debug status :param value: The debug status, True or False. @@ -287,7 +404,7 @@ def debug(self): return self.__debug @debug.setter - def debug(self, value): + def debug(self, value: bool) -> None: """Debug status :param value: The debug status, True or False. @@ -298,18 +415,18 @@ def debug(self, value): # if debug status is True, turn on debug logging for _, logger in self.logger.items(): logger.setLevel(logging.DEBUG) - # turn on http_client debug - http_client.HTTPConnection.debuglevel = 1 + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 else: # if debug status is False, turn off debug logging, # setting log level to default `logging.WARNING` for _, logger in self.logger.items(): logger.setLevel(logging.WARNING) - # turn off http_client debug - http_client.HTTPConnection.debuglevel = 0 + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 @property - def logger_format(self): + def logger_format(self) -> str: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -320,7 +437,7 @@ def logger_format(self): return self.__logger_format @logger_format.setter - def logger_format(self, value): + def logger_format(self, value: str) -> None: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -331,7 +448,7 @@ def logger_format(self, value): self.__logger_format = value self.logger_formatter = logging.Formatter(self.__logger_format) - def get_api_key_with_prefix(self, identifier, alias=None): + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: """Gets API key (with prefix if set). :param identifier: The identifier of apiKey. @@ -348,7 +465,9 @@ def get_api_key_with_prefix(self, identifier, alias=None): else: return key - def get_basic_auth_token(self): + return None + + def get_basic_auth_token(self) -> Optional[str]: """Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. @@ -363,14 +482,23 @@ def get_basic_auth_token(self): basic_auth=username + ':' + password ).get('authorization') - async def auth_settings(self): + def auth_settings(self)-> AuthSettings: """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ - return {} + auth: AuthSettings = {} + if self.access_token is not None: + auth['bearerAuth'] = { + 'type': 'bearer', + 'in': 'header', + 'format': 'JWT', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + return auth - def to_debug_report(self): + def to_debug_report(self) -> str: """Gets the essential information for debugging. :return: The report for debugging. @@ -378,23 +506,28 @@ def to_debug_report(self): return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 20.14.0-SNAPSHOT\n"\ + "Version of the API: 1.0.0\n"\ "SDK Package Version: 1.0.0".\ format(env=sys.platform, pyversion=sys.version) - def get_host_settings(self): + def get_host_settings(self) -> List[HostSetting]: """Gets an array of host settings :return: An array of host settings """ return [ { - 'url': "", + 'url': "/profile-manager", 'description': "No description provided", } ] - def get_host_from_settings(self, index, variables=None, servers=None): + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: """Gets host URL based on the index and variables :param index: array index of the host settings :param variables: hash of variable and the corresponding value @@ -434,12 +567,12 @@ def get_host_from_settings(self, index, variables=None, servers=None): return url @property - def host(self): + def host(self) -> str: """Return generated host.""" return self.get_host_from_settings(self.server_index, variables=self.server_variables) @host.setter - def host(self, value): + def host(self, value: str) -> None: """Fix base path.""" self._base_path = value self.server_index = None diff --git a/symphony/bdk/gen/exceptions.py b/symphony/bdk/gen/exceptions.py index 9d81896d..4785622d 100644 --- a/symphony/bdk/gen/exceptions.py +++ b/symphony/bdk/gen/exceptions.py @@ -1,13 +1,18 @@ +# coding: utf-8 + """ - Agent API + Symphony Profile Manager - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - A new authorizationToken has been introduced in the authenticationAPI response payload. It can be used to replace the sessionToken in any of the API calls and can be passed as \"Authorization\" header. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://docs.developers.symphony.com/building-bots-on-symphony/messages/overview-of-messageml - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 + Profile Manager is a microservice to manage users profile and groups - The version of the OpenAPI document: 20.14.0-SNAPSHOT - Generated by: https://openapi-generator.tech -""" + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 +from typing import Any, Optional +from typing_extensions import Self class OpenApiException(Exception): """The base exception class for all OpenAPIExceptions""" @@ -15,7 +20,7 @@ class OpenApiException(Exception): class ApiTypeError(OpenApiException, TypeError): def __init__(self, msg, path_to_item=None, valid_classes=None, - key_type=None): + key_type=None) -> None: """ Raises an exception for TypeErrors Args: @@ -43,7 +48,7 @@ def __init__(self, msg, path_to_item=None, valid_classes=None, class ApiValueError(OpenApiException, ValueError): - def __init__(self, msg, path_to_item=None): + def __init__(self, msg, path_to_item=None) -> None: """ Args: msg (str): the exception message @@ -61,7 +66,7 @@ def __init__(self, msg, path_to_item=None): class ApiAttributeError(OpenApiException, AttributeError): - def __init__(self, msg, path_to_item=None): + def __init__(self, msg, path_to_item=None) -> None: """ Raised when an attribute reference or assignment fails. @@ -80,7 +85,7 @@ def __init__(self, msg, path_to_item=None): class ApiKeyError(OpenApiException, KeyError): - def __init__(self, msg, path_to_item=None): + def __init__(self, msg, path_to_item=None) -> None: """ Args: msg (str): the exception message @@ -98,17 +103,56 @@ def __init__(self, msg, path_to_item=None): class ApiException(OpenApiException): - def __init__(self, status=None, reason=None, http_resp=None): + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + if http_resp: - self.status = http_resp.status - self.reason = http_resp.reason - self.body = http_resp.data + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass self.headers = http_resp.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(http_resp=http_resp, body=body, data=data) + + if 500 <= http_resp.status <= 599: + raise ServiceException(http_resp=http_resp, body=body, data=data) + raise ApiException(http_resp=http_resp, body=body, data=data) def __str__(self): """Custom error messages for exception""" @@ -118,34 +162,30 @@ def __str__(self): error_message += "HTTP response headers: {0}\n".format( self.headers) - if self.body: - error_message += "HTTP response body: {0}\n".format(self.body) + if self.data or self.body: + error_message += "HTTP response body: {0}\n".format(self.data or self.body) return error_message -class NotFoundException(ApiException): +class BadRequestException(ApiException): + pass - def __init__(self, status=None, reason=None, http_resp=None): - super(NotFoundException, self).__init__(status, reason, http_resp) +class NotFoundException(ApiException): + pass -class UnauthorizedException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None): - super(UnauthorizedException, self).__init__(status, reason, http_resp) +class UnauthorizedException(ApiException): + pass class ForbiddenException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None): - super(ForbiddenException, self).__init__(status, reason, http_resp) + pass class ServiceException(ApiException): - - def __init__(self, status=None, reason=None, http_resp=None): - super(ServiceException, self).__init__(status, reason, http_resp) + pass def render_path(path_to_item): diff --git a/symphony/bdk/gen/group_api/__init__.py b/symphony/bdk/gen/group_api/__init__.py deleted file mode 100644 index a14105e9..00000000 --- a/symphony/bdk/gen/group_api/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# do not import all models into this module because that uses a lot of memory and stack frames diff --git a/symphony/bdk/gen/group_api/group_api.py b/symphony/bdk/gen/group_api/group_api.py index d53054d9..e8cadf7e 100644 --- a/symphony/bdk/gen/group_api/group_api.py +++ b/symphony/bdk/gen/group_api/group_api.py @@ -1,29 +1,26 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated from symphony.bdk.gen.group_model.add_member import AddMember from symphony.bdk.gen.group_model.create_group import CreateGroup -from symphony.bdk.gen.group_model.error import Error from symphony.bdk.gen.group_model.group_list import GroupList from symphony.bdk.gen.group_model.read_group import ReadGroup from symphony.bdk.gen.group_model.sort_order import SortOrder @@ -31,1086 +28,2235 @@ from symphony.bdk.gen.group_model.update_group import UpdateGroup from symphony.bdk.gen.group_model.upload_avatar import UploadAvatar +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class GroupApi(object): + +class GroupApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.add_member_to_group_endpoint = _Endpoint( - settings={ - 'response_type': (ReadGroup,), - 'auth': [ - 'bearerAuth' - ], - 'endpoint_path': '/v1/groups/{groupId}/member', - 'operation_id': 'add_member_to_group', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'x_symphony_host', - 'group_id', - 'add_member', - ], - 'required': [ - 'x_symphony_host', - 'group_id', - 'add_member', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - 'x_symphony_host', - ] - }, - root_map={ - 'validations': { - ('x_symphony_host',): { - - 'min_length': 1, - }, - }, - 'allowed_values': { - }, - 'openapi_types': { - 'x_symphony_host': - (str,), - 'group_id': - (str,), - 'add_member': - (AddMember,), - }, - 'attribute_map': { - 'x_symphony_host': 'X-Symphony-Host', - 'group_id': 'groupId', - }, - 'location_map': { - 'x_symphony_host': 'header', - 'group_id': 'path', - 'add_member': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client + + + @validate_call + async def add_member_to_group( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + group_id: StrictStr, + add_member: Annotated[AddMember, Field(description="JSON object containing the user member information and the group on which he will be added to")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ReadGroup: + """Add a new user to a an existing group + + Add a new user to a an existing group + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param group_id: (required) + :type group_id: str + :param add_member: JSON object containing the user member information and the group on which he will be added to (required) + :type add_member: AddMember + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_member_to_group_serialize( + x_symphony_host=x_symphony_host, + group_id=group_id, + add_member=add_member, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - self.delete_all_groups_endpoint = _Endpoint( - settings={ - 'response_type': (GroupList,), - 'auth': [ - 'bearerAuth' - ], - 'endpoint_path': '/v1/groups/deleteAll', - 'operation_id': 'delete_all_groups', - 'http_method': 'DELETE', - 'servers': None, - }, - params_map={ - 'all': [ - 'x_symphony_host', - ], - 'required': [ - 'x_symphony_host', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - 'x_symphony_host', - ] - }, - root_map={ - 'validations': { - ('x_symphony_host',): { - - 'min_length': 1, - }, - }, - 'allowed_values': { - }, - 'openapi_types': { - 'x_symphony_host': - (str,), - }, - 'attribute_map': { - 'x_symphony_host': 'X-Symphony-Host', - }, - 'location_map': { - 'x_symphony_host': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '429': "Error", + '452': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - self.get_group_endpoint = _Endpoint( - settings={ - 'response_type': (ReadGroup,), - 'auth': [ - 'bearerAuth' - ], - 'endpoint_path': '/v1/groups/{groupId}', - 'operation_id': 'get_group', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'x_symphony_host', - 'group_id', - ], - 'required': [ - 'x_symphony_host', - 'group_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - 'x_symphony_host', - ] - }, - root_map={ - 'validations': { - ('x_symphony_host',): { - - 'min_length': 1, - }, - }, - 'allowed_values': { - }, - 'openapi_types': { - 'x_symphony_host': - (str,), - 'group_id': - (str,), - }, - 'attribute_map': { - 'x_symphony_host': 'X-Symphony-Host', - 'group_id': 'groupId', - }, - 'location_map': { - 'x_symphony_host': 'header', - 'group_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def add_member_to_group_with_http_info( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + group_id: StrictStr, + add_member: Annotated[AddMember, Field(description="JSON object containing the user member information and the group on which he will be added to")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ReadGroup]: + """Add a new user to a an existing group + + Add a new user to a an existing group + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param group_id: (required) + :type group_id: str + :param add_member: JSON object containing the user member information and the group on which he will be added to (required) + :type add_member: AddMember + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_member_to_group_serialize( + x_symphony_host=x_symphony_host, + group_id=group_id, + add_member=add_member, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - self.insert_group_endpoint = _Endpoint( - settings={ - 'response_type': (ReadGroup,), - 'auth': [ - 'bearerAuth' - ], - 'endpoint_path': '/v1/groups', - 'operation_id': 'insert_group', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'x_symphony_host', - 'create_group', - ], - 'required': [ - 'x_symphony_host', - 'create_group', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - 'x_symphony_host', - ] - }, - root_map={ - 'validations': { - ('x_symphony_host',): { - - 'min_length': 1, - }, - }, - 'allowed_values': { - }, - 'openapi_types': { - 'x_symphony_host': - (str,), - 'create_group': - (CreateGroup,), - }, - 'attribute_map': { - 'x_symphony_host': 'X-Symphony-Host', - }, - 'location_map': { - 'x_symphony_host': 'header', - 'create_group': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '429': "Error", + '452': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - self.list_groups_endpoint = _Endpoint( - settings={ - 'response_type': (GroupList,), - 'auth': [ - 'bearerAuth' - ], - 'endpoint_path': '/v1/groups/type/{typeId}', - 'operation_id': 'list_groups', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'x_symphony_host', - 'type_id', - 'status', - 'before', - 'after', - 'limit', - 'sort_order', - ], - 'required': [ - 'x_symphony_host', - 'type_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - 'x_symphony_host', - ] - }, - root_map={ - 'validations': { - ('x_symphony_host',): { - - 'min_length': 1, - }, - }, - 'allowed_values': { - }, - 'openapi_types': { - 'x_symphony_host': - (str,), - 'type_id': - (str,), - 'status': - (Status,), - 'before': - (str,), - 'after': - (str,), - 'limit': - (int,), - 'sort_order': - (SortOrder,), - }, - 'attribute_map': { - 'x_symphony_host': 'X-Symphony-Host', - 'type_id': 'typeId', - 'status': 'status', - 'before': 'before', - 'after': 'after', - 'limit': 'limit', - 'sort_order': 'sortOrder', - }, - 'location_map': { - 'x_symphony_host': 'header', - 'type_id': 'path', - 'status': 'query', - 'before': 'query', - 'after': 'query', - 'limit': 'query', - 'sort_order': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - self.update_avatar_endpoint = _Endpoint( - settings={ - 'response_type': (ReadGroup,), - 'auth': [ - 'bearerAuth' - ], - 'endpoint_path': '/v1/groups/{groupId}/avatar', - 'operation_id': 'update_avatar', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'x_symphony_host', - 'group_id', - 'upload_avatar', - ], - 'required': [ - 'x_symphony_host', - 'group_id', - 'upload_avatar', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - 'x_symphony_host', - ] - }, - root_map={ - 'validations': { - ('x_symphony_host',): { - - 'min_length': 1, - }, - }, - 'allowed_values': { - }, - 'openapi_types': { - 'x_symphony_host': - (str,), - 'group_id': - (str,), - 'upload_avatar': - (UploadAvatar,), - }, - 'attribute_map': { - 'x_symphony_host': 'X-Symphony-Host', - 'group_id': 'groupId', - }, - 'location_map': { - 'x_symphony_host': 'header', - 'group_id': 'path', - 'upload_avatar': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client + + + @validate_call + async def add_member_to_group_without_preload_content( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + group_id: StrictStr, + add_member: Annotated[AddMember, Field(description="JSON object containing the user member information and the group on which he will be added to")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add a new user to a an existing group + + Add a new user to a an existing group + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param group_id: (required) + :type group_id: str + :param add_member: JSON object containing the user member information and the group on which he will be added to (required) + :type add_member: AddMember + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._add_member_to_group_serialize( + x_symphony_host=x_symphony_host, + group_id=group_id, + add_member=add_member, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - self.update_group_endpoint = _Endpoint( - settings={ - 'response_type': (ReadGroup,), - 'auth': [ - 'bearerAuth' - ], - 'endpoint_path': '/v1/groups/{groupId}', - 'operation_id': 'update_group', - 'http_method': 'PUT', - 'servers': None, - }, - params_map={ - 'all': [ - 'x_symphony_host', - 'if_match', - 'group_id', - 'update_group', - ], - 'required': [ - 'x_symphony_host', - 'if_match', - 'group_id', - 'update_group', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - 'x_symphony_host', - ] - }, - root_map={ - 'validations': { - ('x_symphony_host',): { - - 'min_length': 1, - }, - }, - 'allowed_values': { - }, - 'openapi_types': { - 'x_symphony_host': - (str,), - 'if_match': - (str,), - 'group_id': - (str,), - 'update_group': - (UpdateGroup,), - }, - 'attribute_map': { - 'x_symphony_host': 'X-Symphony-Host', - 'if_match': 'If-Match', - 'group_id': 'groupId', - }, - 'location_map': { - 'x_symphony_host': 'header', - 'if_match': 'header', - 'group_id': 'path', - 'update_group': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '429': "Error", + '452': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + return response_data.response + - def add_member_to_group( + def _add_member_to_group_serialize( self, x_symphony_host, group_id, add_member, - **kwargs - ): - """Add a new user to a an existing group # noqa: E501 - - Add a new user to a an existing group # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = group_api.add_member_to_group(x_symphony_host, group_id, add_member, async_req=True) - >>> result = thread.get() - - Args: - x_symphony_host (str): - group_id (str): - add_member (AddMember): JSON object containing the user member information and the group on which he will be added to - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ReadGroup - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group_id is not None: + _path_params['groupId'] = group_id + # process the query parameters + # process the header parameters + if x_symphony_host is not None: + _header_params['X-Symphony-Host'] = x_symphony_host + # process the form parameters + # process the body parameter + if add_member is not None: + _body_params = add_member + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/groups/{groupId}/member', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def delete_all_groups( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GroupList: + """Delete all data related to the current pod (extracted from JWT). This endpoint is for maintenance/test and it is usually disabled or restricted + + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_all_groups_serialize( + x_symphony_host=x_symphony_host, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupList", + '400': "Error", + '401': "Error", + '403': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_all_groups_with_http_info( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GroupList]: + """Delete all data related to the current pod (extracted from JWT). This endpoint is for maintenance/test and it is usually disabled or restricted + + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_all_groups_serialize( + x_symphony_host=x_symphony_host, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupList", + '400': "Error", + '401': "Error", + '403': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def delete_all_groups_without_preload_content( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete all data related to the current pod (extracted from JWT). This endpoint is for maintenance/test and it is usually disabled or restricted + + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_all_groups_serialize( + x_symphony_host=x_symphony_host, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupList", + '400': "Error", + '401': "Error", + '403': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['x_symphony_host'] = \ - x_symphony_host - kwargs['group_id'] = \ - group_id - kwargs['add_member'] = \ - add_member - return self.add_member_to_group_endpoint.call_with_http_info(**kwargs) - - def delete_all_groups( + return response_data.response + + + def _delete_all_groups_serialize( self, x_symphony_host, - **kwargs - ): - """Delete all data related to the current pod (extracted from JWT). This endpoint is for maintenance/test and it is usually disabled or restricted # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = group_api.delete_all_groups(x_symphony_host, async_req=True) - >>> result = thread.get() - - Args: - x_symphony_host (str): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - GroupList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if x_symphony_host is not None: + _header_params['X-Symphony-Host'] = x_symphony_host + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/groups/deleteAll', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def get_group( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + group_id: Annotated[StrictStr, Field(description="Group id")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ReadGroup: + """Retrieve a group + + Retrieve a group + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param group_id: Group id (required) + :type group_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_serialize( + x_symphony_host=x_symphony_host, + group_id=group_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_group_with_http_info( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + group_id: Annotated[StrictStr, Field(description="Group id")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ReadGroup]: + """Retrieve a group + + Retrieve a group + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param group_id: Group id (required) + :type group_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_serialize( + x_symphony_host=x_symphony_host, + group_id=group_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def get_group_without_preload_content( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + group_id: Annotated[StrictStr, Field(description="Group id")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a group + + Retrieve a group + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param group_id: Group id (required) + :type group_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_group_serialize( + x_symphony_host=x_symphony_host, + group_id=group_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['x_symphony_host'] = \ - x_symphony_host - return self.delete_all_groups_endpoint.call_with_http_info(**kwargs) - - def get_group( + return response_data.response + + + def _get_group_serialize( self, x_symphony_host, group_id, - **kwargs - ): - """Retrieve a group # noqa: E501 - - Retrieve a group # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = group_api.get_group(x_symphony_host, group_id, async_req=True) - >>> result = thread.get() - - Args: - x_symphony_host (str): - group_id (str): Group id - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ReadGroup - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group_id is not None: + _path_params['groupId'] = group_id + # process the query parameters + # process the header parameters + if x_symphony_host is not None: + _header_params['X-Symphony-Host'] = x_symphony_host + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/groups/{groupId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def insert_group( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + create_group: Annotated[CreateGroup, Field(description="JSON object containing Group info")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ReadGroup: + """Insert a new group + + Insert a new group into database + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param create_group: JSON object containing Group info (required) + :type create_group: CreateGroup + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._insert_group_serialize( + x_symphony_host=x_symphony_host, + create_group=create_group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '429': "Error", + '452': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def insert_group_with_http_info( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + create_group: Annotated[CreateGroup, Field(description="JSON object containing Group info")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ReadGroup]: + """Insert a new group + + Insert a new group into database + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param create_group: JSON object containing Group info (required) + :type create_group: CreateGroup + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._insert_group_serialize( + x_symphony_host=x_symphony_host, + create_group=create_group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '429': "Error", + '452': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def insert_group_without_preload_content( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + create_group: Annotated[CreateGroup, Field(description="JSON object containing Group info")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Insert a new group + + Insert a new group into database + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param create_group: JSON object containing Group info (required) + :type create_group: CreateGroup + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._insert_group_serialize( + x_symphony_host=x_symphony_host, + create_group=create_group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '201': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '429': "Error", + '452': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['x_symphony_host'] = \ - x_symphony_host - kwargs['group_id'] = \ - group_id - return self.get_group_endpoint.call_with_http_info(**kwargs) - - def insert_group( + return response_data.response + + + def _insert_group_serialize( self, x_symphony_host, create_group, - **kwargs - ): - """Insert a new group # noqa: E501 - - Insert a new group into database # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = group_api.insert_group(x_symphony_host, create_group, async_req=True) - >>> result = thread.get() - - Args: - x_symphony_host (str): - create_group (CreateGroup): JSON object containing Group info - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ReadGroup - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if x_symphony_host is not None: + _header_params['X-Symphony-Host'] = x_symphony_host + # process the form parameters + # process the body parameter + if create_group is not None: + _body_params = create_group + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/groups', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_groups( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + type_id: Annotated[StrictStr, Field(description="Group type id")], + status: Annotated[Optional[Status], Field(description="filter by status, active or deleted. If not specified both are returned")] = None, + before: Annotated[Optional[StrictStr], Field(description="NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page")] = None, + after: Annotated[Optional[StrictStr], Field(description="cursor that points to the end of the current page of data. If not present, the current page is the last page")] = None, + limit: Annotated[Optional[StrictInt], Field(description="numbers of items to return")] = None, + sort_order: Annotated[Optional[SortOrder], Field(description="items sorting direction (ordered by createdDate)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GroupList: + """List all groups of specified type + + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param type_id: Group type id (required) + :type type_id: str + :param status: filter by status, active or deleted. If not specified both are returned + :type status: Status + :param before: NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page + :type before: str + :param after: cursor that points to the end of the current page of data. If not present, the current page is the last page + :type after: str + :param limit: numbers of items to return + :type limit: int + :param sort_order: items sorting direction (ordered by createdDate) + :type sort_order: SortOrder + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_groups_serialize( + x_symphony_host=x_symphony_host, + type_id=type_id, + status=status, + before=before, + after=after, + limit=limit, + sort_order=sort_order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupList", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_groups_with_http_info( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + type_id: Annotated[StrictStr, Field(description="Group type id")], + status: Annotated[Optional[Status], Field(description="filter by status, active or deleted. If not specified both are returned")] = None, + before: Annotated[Optional[StrictStr], Field(description="NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page")] = None, + after: Annotated[Optional[StrictStr], Field(description="cursor that points to the end of the current page of data. If not present, the current page is the last page")] = None, + limit: Annotated[Optional[StrictInt], Field(description="numbers of items to return")] = None, + sort_order: Annotated[Optional[SortOrder], Field(description="items sorting direction (ordered by createdDate)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GroupList]: + """List all groups of specified type + + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param type_id: Group type id (required) + :type type_id: str + :param status: filter by status, active or deleted. If not specified both are returned + :type status: Status + :param before: NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page + :type before: str + :param after: cursor that points to the end of the current page of data. If not present, the current page is the last page + :type after: str + :param limit: numbers of items to return + :type limit: int + :param sort_order: items sorting direction (ordered by createdDate) + :type sort_order: SortOrder + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_groups_serialize( + x_symphony_host=x_symphony_host, + type_id=type_id, + status=status, + before=before, + after=after, + limit=limit, + sort_order=sort_order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupList", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def list_groups_without_preload_content( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + type_id: Annotated[StrictStr, Field(description="Group type id")], + status: Annotated[Optional[Status], Field(description="filter by status, active or deleted. If not specified both are returned")] = None, + before: Annotated[Optional[StrictStr], Field(description="NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page")] = None, + after: Annotated[Optional[StrictStr], Field(description="cursor that points to the end of the current page of data. If not present, the current page is the last page")] = None, + limit: Annotated[Optional[StrictInt], Field(description="numbers of items to return")] = None, + sort_order: Annotated[Optional[SortOrder], Field(description="items sorting direction (ordered by createdDate)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all groups of specified type + + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param type_id: Group type id (required) + :type type_id: str + :param status: filter by status, active or deleted. If not specified both are returned + :type status: Status + :param before: NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page + :type before: str + :param after: cursor that points to the end of the current page of data. If not present, the current page is the last page + :type after: str + :param limit: numbers of items to return + :type limit: int + :param sort_order: items sorting direction (ordered by createdDate) + :type sort_order: SortOrder + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_groups_serialize( + x_symphony_host=x_symphony_host, + type_id=type_id, + status=status, + before=before, + after=after, + limit=limit, + sort_order=sort_order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GroupList", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['x_symphony_host'] = \ - x_symphony_host - kwargs['create_group'] = \ - create_group - return self.insert_group_endpoint.call_with_http_info(**kwargs) - - def list_groups( + return response_data.response + + + def _list_groups_serialize( self, x_symphony_host, type_id, - **kwargs - ): - """List all groups of specified type # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = group_api.list_groups(x_symphony_host, type_id, async_req=True) - >>> result = thread.get() - - Args: - x_symphony_host (str): - type_id (str): Group type id - - Keyword Args: - status (Status): filter by status, active or deleted. If not specified both are returned. [optional] - before (str): NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page. [optional] - after (str): cursor that points to the end of the current page of data. If not present, the current page is the last page. [optional] - limit (int): numbers of items to return. [optional] - sort_order (SortOrder): items sorting direction (ordered by createdDate). [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - GroupList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + status, + before, + after, + limit, + sort_order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if type_id is not None: + _path_params['typeId'] = type_id + # process the query parameters + if status is not None: + + _query_params.append(('status', status.value)) + + if before is not None: + + _query_params.append(('before', before)) + + if after is not None: + + _query_params.append(('after', after)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if sort_order is not None: + + _query_params.append(('sortOrder', sort_order.value)) + + # process the header parameters + if x_symphony_host is not None: + _header_params['X-Symphony-Host'] = x_symphony_host + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/groups/type/{typeId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_avatar( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + group_id: Annotated[StrictStr, Field(description="Group id")], + upload_avatar: Annotated[UploadAvatar, Field(description="JSON object containing Group avatar")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ReadGroup: + """Update the group avatar + + Update the group account avatar + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param group_id: Group id (required) + :type group_id: str + :param upload_avatar: JSON object containing Group avatar (required) + :type upload_avatar: UploadAvatar + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_avatar_serialize( + x_symphony_host=x_symphony_host, + group_id=group_id, + upload_avatar=upload_avatar, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_avatar_with_http_info( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + group_id: Annotated[StrictStr, Field(description="Group id")], + upload_avatar: Annotated[UploadAvatar, Field(description="JSON object containing Group avatar")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ReadGroup]: + """Update the group avatar + + Update the group account avatar + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param group_id: Group id (required) + :type group_id: str + :param upload_avatar: JSON object containing Group avatar (required) + :type upload_avatar: UploadAvatar + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_avatar_serialize( + x_symphony_host=x_symphony_host, + group_id=group_id, + upload_avatar=upload_avatar, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def update_avatar_without_preload_content( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + group_id: Annotated[StrictStr, Field(description="Group id")], + upload_avatar: Annotated[UploadAvatar, Field(description="JSON object containing Group avatar")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the group avatar + + Update the group account avatar + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param group_id: Group id (required) + :type group_id: str + :param upload_avatar: JSON object containing Group avatar (required) + :type upload_avatar: UploadAvatar + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_avatar_serialize( + x_symphony_host=x_symphony_host, + group_id=group_id, + upload_avatar=upload_avatar, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['x_symphony_host'] = \ - x_symphony_host - kwargs['type_id'] = \ - type_id - return self.list_groups_endpoint.call_with_http_info(**kwargs) - - def update_avatar( + return response_data.response + + + def _update_avatar_serialize( self, x_symphony_host, group_id, upload_avatar, - **kwargs - ): - """Update the group avatar # noqa: E501 - - Update the group account avatar # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = group_api.update_avatar(x_symphony_host, group_id, upload_avatar, async_req=True) - >>> result = thread.get() - - Args: - x_symphony_host (str): - group_id (str): Group id - upload_avatar (UploadAvatar): JSON object containing Group avatar - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ReadGroup - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group_id is not None: + _path_params['groupId'] = group_id + # process the query parameters + # process the header parameters + if x_symphony_host is not None: + _header_params['X-Symphony-Host'] = x_symphony_host + # process the form parameters + # process the body parameter + if upload_avatar is not None: + _body_params = upload_avatar + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/groups/{groupId}/avatar', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def update_group( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + if_match: StrictStr, + group_id: Annotated[StrictStr, Field(description="Group id")], + update_group: Annotated[UpdateGroup, Field(description="JSON object containing Group info")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ReadGroup: + """Update a group + + Update an existing group + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param if_match: (required) + :type if_match: str + :param group_id: Group id (required) + :type group_id: str + :param update_group: JSON object containing Group info (required) + :type update_group: UpdateGroup + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_group_serialize( + x_symphony_host=x_symphony_host, + if_match=if_match, + group_id=group_id, + update_group=update_group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '412': "Error", + '429': "Error", + '452': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def update_group_with_http_info( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + if_match: StrictStr, + group_id: Annotated[StrictStr, Field(description="Group id")], + update_group: Annotated[UpdateGroup, Field(description="JSON object containing Group info")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ReadGroup]: + """Update a group + + Update an existing group + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param if_match: (required) + :type if_match: str + :param group_id: Group id (required) + :type group_id: str + :param update_group: JSON object containing Group info (required) + :type update_group: UpdateGroup + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_group_serialize( + x_symphony_host=x_symphony_host, + if_match=if_match, + group_id=group_id, + update_group=update_group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '412': "Error", + '429': "Error", + '452': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def update_group_without_preload_content( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + if_match: StrictStr, + group_id: Annotated[StrictStr, Field(description="Group id")], + update_group: Annotated[UpdateGroup, Field(description="JSON object containing Group info")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update a group + + Update an existing group + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param if_match: (required) + :type if_match: str + :param group_id: Group id (required) + :type group_id: str + :param update_group: JSON object containing Group info (required) + :type update_group: UpdateGroup + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_group_serialize( + x_symphony_host=x_symphony_host, + if_match=if_match, + group_id=group_id, + update_group=update_group, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReadGroup", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '412': "Error", + '429': "Error", + '452': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['x_symphony_host'] = \ - x_symphony_host - kwargs['group_id'] = \ - group_id - kwargs['upload_avatar'] = \ - upload_avatar - return self.update_avatar_endpoint.call_with_http_info(**kwargs) - - def update_group( + return response_data.response + + + def _update_group_serialize( self, x_symphony_host, if_match, group_id, update_group, - **kwargs - ): - """Update a group # noqa: E501 - - Update an existing group # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = group_api.update_group(x_symphony_host, if_match, group_id, update_group, async_req=True) - >>> result = thread.get() - - Args: - x_symphony_host (str): - if_match (str): - group_id (str): Group id - update_group (UpdateGroup): JSON object containing Group info - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ReadGroup - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if group_id is not None: + _path_params['groupId'] = group_id + # process the query parameters + # process the header parameters + if x_symphony_host is not None: + _header_params['X-Symphony-Host'] = x_symphony_host + if if_match is not None: + _header_params['If-Match'] = if_match + # process the form parameters + # process the body parameter + if update_group is not None: + _body_params = update_group + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/groups/{groupId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['x_symphony_host'] = \ - x_symphony_host - kwargs['if_match'] = \ - if_match - kwargs['group_id'] = \ - group_id - kwargs['update_group'] = \ - update_group - return self.update_group_endpoint.call_with_http_info(**kwargs) + diff --git a/symphony/bdk/gen/group_api/type_api.py b/symphony/bdk/gen/group_api/type_api.py index 414cb345..6b0ba5a9 100644 --- a/symphony/bdk/gen/group_api/type_api.py +++ b/symphony/bdk/gen/group_api/type_api.py @@ -1,349 +1,685 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.group_model.error import Error +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated from symphony.bdk.gen.group_model.sort_order import SortOrder from symphony.bdk.gen.group_model.status import Status from symphony.bdk.gen.group_model.type import Type from symphony.bdk.gen.group_model.type_list import TypeList +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class TypeApi(object): +class TypeApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.get_type_endpoint = _Endpoint( - settings={ - 'response_type': (Type,), - 'auth': [ - 'bearerAuth' - ], - 'endpoint_path': '/v1/types/{typeId}', - 'operation_id': 'get_type', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'x_symphony_host', - 'type_id', - ], - 'required': [ - 'x_symphony_host', - 'type_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - 'x_symphony_host', - ] - }, - root_map={ - 'validations': { - ('x_symphony_host',): { - - 'min_length': 1, - }, - }, - 'allowed_values': { - }, - 'openapi_types': { - 'x_symphony_host': - (str,), - 'type_id': - (str,), - }, - 'attribute_map': { - 'x_symphony_host': 'X-Symphony-Host', - 'type_id': 'typeId', - }, - 'location_map': { - 'x_symphony_host': 'header', - 'type_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.list_types_endpoint = _Endpoint( - settings={ - 'response_type': (TypeList,), - 'auth': [ - 'bearerAuth' - ], - 'endpoint_path': '/v1/types', - 'operation_id': 'list_types', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'x_symphony_host', - 'status', - 'before', - 'after', - 'limit', - 'sort_order', - ], - 'required': [ - 'x_symphony_host', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - 'x_symphony_host', - ] - }, - root_map={ - 'validations': { - ('x_symphony_host',): { - - 'min_length': 1, - }, - }, - 'allowed_values': { - }, - 'openapi_types': { - 'x_symphony_host': - (str,), - 'status': - (Status,), - 'before': - (str,), - 'after': - (str,), - 'limit': - (int,), - 'sort_order': - (SortOrder,), - }, - 'attribute_map': { - 'x_symphony_host': 'X-Symphony-Host', - 'status': 'status', - 'before': 'before', - 'after': 'after', - 'limit': 'limit', - 'sort_order': 'sortOrder', - }, - 'location_map': { - 'x_symphony_host': 'header', - 'status': 'query', - 'before': 'query', - 'after': 'query', - 'limit': 'query', - 'sort_order': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - def get_type( + + @validate_call + async def get_type( self, - x_symphony_host, - type_id, - **kwargs - ): - """Retrieve a type # noqa: E501 - - Retrieve a type # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = group_api.get_type(x_symphony_host, type_id, async_req=True) - >>> result = thread.get() - - Args: - x_symphony_host (str): - type_id (str): Type id - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Type - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + type_id: Annotated[StrictStr, Field(description="Type id")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Type: + """Retrieve a type + + Retrieve a type + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param type_id: Type id (required) + :type type_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_type_serialize( + x_symphony_host=x_symphony_host, + type_id=type_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Type", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def get_type_with_http_info( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + type_id: Annotated[StrictStr, Field(description="Type id")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Type]: + """Retrieve a type + + Retrieve a type + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param type_id: Type id (required) + :type type_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_type_serialize( + x_symphony_host=x_symphony_host, + type_id=type_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Type", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def get_type_without_preload_content( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + type_id: Annotated[StrictStr, Field(description="Type id")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a type + + Retrieve a type + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param type_id: Type id (required) + :type type_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_type_serialize( + x_symphony_host=x_symphony_host, + type_id=type_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Type", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['x_symphony_host'] = \ - x_symphony_host - kwargs['type_id'] = \ - type_id - return self.get_type_endpoint.call_with_http_info(**kwargs) - - def list_types( + return response_data.response + + + def _get_type_serialize( self, x_symphony_host, - **kwargs - ): - """List all types # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = group_api.list_types(x_symphony_host, async_req=True) - >>> result = thread.get() - - Args: - x_symphony_host (str): - - Keyword Args: - status (Status): [optional] - before (str): NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page. [optional] - after (str): cursor that points to the end of the current page of data. If not present, the current page is the last page. [optional] - limit (int): numbers of items to return. [optional] - sort_order (SortOrder): items sorting direction (ordered by createdDate). [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - TypeList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + type_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if type_id is not None: + _path_params['typeId'] = type_id + # process the query parameters + # process the header parameters + if x_symphony_host is not None: + _header_params['X-Symphony-Host'] = x_symphony_host + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/types/{typeId}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def list_types( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + status: Optional[Status] = None, + before: Annotated[Optional[StrictStr], Field(description="NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page")] = None, + after: Annotated[Optional[StrictStr], Field(description="cursor that points to the end of the current page of data. If not present, the current page is the last page")] = None, + limit: Annotated[Optional[StrictInt], Field(description="numbers of items to return")] = None, + sort_order: Annotated[Optional[SortOrder], Field(description="items sorting direction (ordered by createdDate)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> TypeList: + """List all types + + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param status: + :type status: Status + :param before: NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page + :type before: str + :param after: cursor that points to the end of the current page of data. If not present, the current page is the last page + :type after: str + :param limit: numbers of items to return + :type limit: int + :param sort_order: items sorting direction (ordered by createdDate) + :type sort_order: SortOrder + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_types_serialize( + x_symphony_host=x_symphony_host, + status=status, + before=before, + after=after, + limit=limit, + sort_order=sort_order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TypeList", + '401': "Error", + '403': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_types_with_http_info( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + status: Optional[Status] = None, + before: Annotated[Optional[StrictStr], Field(description="NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page")] = None, + after: Annotated[Optional[StrictStr], Field(description="cursor that points to the end of the current page of data. If not present, the current page is the last page")] = None, + limit: Annotated[Optional[StrictInt], Field(description="numbers of items to return")] = None, + sort_order: Annotated[Optional[SortOrder], Field(description="items sorting direction (ordered by createdDate)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[TypeList]: + """List all types + + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param status: + :type status: Status + :param before: NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page + :type before: str + :param after: cursor that points to the end of the current page of data. If not present, the current page is the last page + :type after: str + :param limit: numbers of items to return + :type limit: int + :param sort_order: items sorting direction (ordered by createdDate) + :type sort_order: SortOrder + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_types_serialize( + x_symphony_host=x_symphony_host, + status=status, + before=before, + after=after, + limit=limit, + sort_order=sort_order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TypeList", + '401': "Error", + '403': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + + @validate_call + async def list_types_without_preload_content( + self, + x_symphony_host: Annotated[str, Field(min_length=1, strict=True)], + status: Optional[Status] = None, + before: Annotated[Optional[StrictStr], Field(description="NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page")] = None, + after: Annotated[Optional[StrictStr], Field(description="cursor that points to the end of the current page of data. If not present, the current page is the last page")] = None, + limit: Annotated[Optional[StrictInt], Field(description="numbers of items to return")] = None, + sort_order: Annotated[Optional[SortOrder], Field(description="items sorting direction (ordered by createdDate)")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all types + + + :param x_symphony_host: (required) + :type x_symphony_host: str + :param status: + :type status: Status + :param before: NOT SUPPORTED YET, currently ignored. Cursor that points to the start of the current page of data. If not present, the current page is the first page + :type before: str + :param after: cursor that points to the end of the current page of data. If not present, the current page is the last page + :type after: str + :param limit: numbers of items to return + :type limit: int + :param sort_order: items sorting direction (ordered by createdDate) + :type sort_order: SortOrder + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_types_serialize( + x_symphony_host=x_symphony_host, + status=status, + before=before, + after=after, + limit=limit, + sort_order=sort_order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TypeList", + '401': "Error", + '403': "Error", + '429': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['x_symphony_host'] = \ - x_symphony_host - return self.list_types_endpoint.call_with_http_info(**kwargs) + return response_data.response + + + def _list_types_serialize( + self, + x_symphony_host, + status, + before, + after, + limit, + sort_order, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if status is not None: + + _query_params.append(('status', status.value)) + + if before is not None: + + _query_params.append(('before', before)) + + if after is not None: + + _query_params.append(('after', after)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if sort_order is not None: + + _query_params.append(('sortOrder', sort_order.value)) + + # process the header parameters + if x_symphony_host is not None: + _header_params['X-Symphony-Host'] = x_symphony_host + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/types', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/group_model/__init__.py b/symphony/bdk/gen/group_model/__init__.py deleted file mode 100644 index a14105e9..00000000 --- a/symphony/bdk/gen/group_model/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# do not import all models into this module because that uses a lot of memory and stack frames diff --git a/symphony/bdk/gen/group_model/add_member.py b/symphony/bdk/gen/group_model/add_member.py index c6597cd2..76b83cbc 100644 --- a/symphony/bdk/gen/group_model/add_member.py +++ b/symphony/bdk/gen/group_model/add_member.py @@ -1,259 +1,91 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.group_model.member import Member -globals()['Member'] = Member +from typing import Optional, Set +from typing_extensions import Self -class AddMember(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class AddMember(BaseModel): """ + AddMember + """ # noqa: E501 + member: Optional[Member] = None + __properties: ClassVar[List[str]] = ["member"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'member': (Member, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'member': 'member', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AddMember - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - member (Member): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AddMember from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AddMember - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - member (Member): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of member + if self.member: + _dict['member'] = self.member.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AddMember from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "member": Member.from_dict(obj["member"]) if obj.get("member") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.member: Member = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/avatar.py b/symphony/bdk/gen/group_model/avatar.py index 7ac5ff57..6613ef88 100644 --- a/symphony/bdk/gen/group_model/avatar.py +++ b/symphony/bdk/gen/group_model/avatar.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Avatar(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'size': (str, none_type), # noqa: E501 - 'url': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Avatar(BaseModel): + """ + Avatar + """ # noqa: E501 + size: Optional[StrictStr] = None + url: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["size", "url"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'size': 'size', # noqa: E501 - 'url': 'url', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Avatar - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - size (str): [optional] # noqa: E501 - url (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Avatar from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Avatar - a group_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - size (str): [optional] # noqa: E501 - url (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Avatar from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "size": obj.get("size"), + "url": obj.get("url") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.size: str = None - self.url: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/base_group.py b/symphony/bdk/gen/group_model/base_group.py index a1189c34..ad77f941 100644 --- a/symphony/bdk/gen/group_model/base_group.py +++ b/symphony/bdk/gen/group_model/base_group.py @@ -1,288 +1,95 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated from symphony.bdk.gen.group_model.owner import Owner -globals()['Owner'] = Owner - -class BaseGroup(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class BaseGroup(BaseModel): """ + A reduced set Group object, for retrieving list of group purpose + """ # noqa: E501 + type: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Group type identifier") + owner_type: Owner = Field(alias="ownerType") + owner_id: StrictInt = Field(description="Owner id if the owner type is tenant (podId) or user (userId), otherwise null", alias="ownerId") + name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Group's name") + __properties: ClassVar[List[str]] = ["type", "ownerType", "ownerId", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - ('type',): { - 'min_length': 1, - }, - ('name',): { - 'min_length': 1, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BaseGroup from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'type': (str,), # noqa: E501 - 'owner_type': (Owner,), # noqa: E501 - 'owner_id': (int,), # noqa: E501 - 'name': (str,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'type': 'type', # noqa: E501 - 'owner_type': 'ownerType', # noqa: E501 - 'owner_id': 'ownerId', # noqa: E501 - 'name': 'name', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, type, owner_type, owner_id, name, *args, **kwargs): # noqa: E501 - """BaseGroup - a group_model defined in OpenAPI - - Args: - type (str): Group type identifier - owner_type (Owner): - owner_id (int): Owner id if the owner type is tenant (podId) or user (userId), otherwise null - name (str): Group's name - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.type = type - self.owner_type = owner_type - self.owner_id = owner_id - self.name = name - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, type, owner_type, owner_id, name, *args, **kwargs): # noqa: E501 - """BaseGroup - a group_model defined in OpenAPI - - Args: - type (str): Group type identifier - owner_type (Owner): - owner_id (int): Owner id if the owner type is tenant (podId) or user (userId), otherwise null - name (str): Group's name - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BaseGroup from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type"), + "ownerType": obj.get("ownerType"), + "ownerId": obj.get("ownerId"), + "name": obj.get("name") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = type - self.owner_type: Owner = owner_type - self.owner_id: int = owner_id - self.name: str = name - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/base_profile.py b/symphony/bdk/gen/group_model/base_profile.py index ea717cc1..defbe70c 100644 --- a/symphony/bdk/gen/group_model/base_profile.py +++ b/symphony/bdk/gen/group_model/base_profile.py @@ -1,342 +1,118 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class BaseProfile(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - ('display_name',): { - 'min_length': 1, - }, - ('market_coverage',): { - }, - ('responsibility',): { - }, - ('function',): { - }, - ('instrument',): { - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'display_name': (str, none_type), # noqa: E501 - 'company_name': (str, none_type), # noqa: E501 - 'email': (str, none_type), # noqa: E501 - 'mobile': (str, none_type), # noqa: E501 - 'job_title': (str, none_type), # noqa: E501 - 'job_role': (str, none_type), # noqa: E501 - 'job_department': (str, none_type), # noqa: E501 - 'job_division': (str, none_type), # noqa: E501 - 'job_phone': (str, none_type), # noqa: E501 - 'job_city': (str, none_type), # noqa: E501 - 'industry_of_interest': ([str], none_type), # noqa: E501 - 'asset_classes_of_interest': ([str], none_type), # noqa: E501 - 'market_coverage': ([str], none_type), # noqa: E501 - 'responsibility': ([str], none_type), # noqa: E501 - 'function': ([str], none_type), # noqa: E501 - 'instrument': ([str], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'display_name': 'displayName', # noqa: E501 - 'company_name': 'companyName', # noqa: E501 - 'email': 'email', # noqa: E501 - 'mobile': 'mobile', # noqa: E501 - 'job_title': 'jobTitle', # noqa: E501 - 'job_role': 'jobRole', # noqa: E501 - 'job_department': 'jobDepartment', # noqa: E501 - 'job_division': 'jobDivision', # noqa: E501 - 'job_phone': 'jobPhone', # noqa: E501 - 'job_city': 'jobCity', # noqa: E501 - 'industry_of_interest': 'industryOfInterest', # noqa: E501 - 'asset_classes_of_interest': 'assetClassesOfInterest', # noqa: E501 - 'market_coverage': 'marketCoverage', # noqa: E501 - 'responsibility': 'responsibility', # noqa: E501 - 'function': 'function', # noqa: E501 - 'instrument': 'instrument', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class BaseProfile(BaseModel): + """ + The group's profile. Please note that in case of a company group type, the profile shouldn't be provided when creating a new company and do not exist in case of an existing company group + """ # noqa: E501 + display_name: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, description="The display name in Directory, it is expected to be the same as group name", alias="displayName") + company_name: Optional[StrictStr] = Field(default=None, description="The company name is expected to be the same as group company owner", alias="companyName") + email: Optional[StrictStr] = None + mobile: Optional[StrictStr] = None + job_title: Optional[StrictStr] = Field(default=None, alias="jobTitle") + job_role: Optional[StrictStr] = Field(default=None, alias="jobRole") + job_department: Optional[StrictStr] = Field(default=None, alias="jobDepartment") + job_division: Optional[StrictStr] = Field(default=None, alias="jobDivision") + job_phone: Optional[StrictStr] = Field(default=None, alias="jobPhone") + job_city: Optional[StrictStr] = Field(default=None, alias="jobCity") + industry_of_interest: Optional[List[StrictStr]] = Field(default=None, alias="industryOfInterest") + asset_classes_of_interest: Optional[List[StrictStr]] = Field(default=None, alias="assetClassesOfInterest") + market_coverage: Optional[List[StrictStr]] = Field(default=None, alias="marketCoverage") + responsibility: Optional[List[StrictStr]] = None + function: Optional[List[StrictStr]] = None + instrument: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["displayName", "companyName", "email", "mobile", "jobTitle", "jobRole", "jobDepartment", "jobDivision", "jobPhone", "jobCity", "industryOfInterest", "assetClassesOfInterest", "marketCoverage", "responsibility", "function", "instrument"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """BaseProfile - a group_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BaseProfile from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - display_name (str): The display name in Directory, it is expected to be the same as group name. [optional] # noqa: E501 - company_name (str): The company name is expected to be the same as group company owner. [optional] # noqa: E501 - email (str): [optional] # noqa: E501 - mobile (str): [optional] # noqa: E501 - job_title (str): [optional] # noqa: E501 - job_role (str): [optional] # noqa: E501 - job_department (str): [optional] # noqa: E501 - job_division (str): [optional] # noqa: E501 - job_phone (str): [optional] # noqa: E501 - job_city (str): [optional] # noqa: E501 - industry_of_interest ([str]): [optional] # noqa: E501 - asset_classes_of_interest ([str]): [optional] # noqa: E501 - market_coverage ([str]): [optional] # noqa: E501 - responsibility ([str]): [optional] # noqa: E501 - function ([str]): [optional] # noqa: E501 - instrument ([str]): [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """BaseProfile - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - display_name (str): The display name in Directory, it is expected to be the same as group name. [optional] # noqa: E501 - company_name (str): The company name is expected to be the same as group company owner. [optional] # noqa: E501 - email (str): [optional] # noqa: E501 - mobile (str): [optional] # noqa: E501 - job_title (str): [optional] # noqa: E501 - job_role (str): [optional] # noqa: E501 - job_department (str): [optional] # noqa: E501 - job_division (str): [optional] # noqa: E501 - job_phone (str): [optional] # noqa: E501 - job_city (str): [optional] # noqa: E501 - industry_of_interest ([str]): [optional] # noqa: E501 - asset_classes_of_interest ([str]): [optional] # noqa: E501 - market_coverage ([str]): [optional] # noqa: E501 - responsibility ([str]): [optional] # noqa: E501 - function ([str]): [optional] # noqa: E501 - instrument ([str]): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BaseProfile from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "displayName": obj.get("displayName"), + "companyName": obj.get("companyName"), + "email": obj.get("email"), + "mobile": obj.get("mobile"), + "jobTitle": obj.get("jobTitle"), + "jobRole": obj.get("jobRole"), + "jobDepartment": obj.get("jobDepartment"), + "jobDivision": obj.get("jobDivision"), + "jobPhone": obj.get("jobPhone"), + "jobCity": obj.get("jobCity"), + "industryOfInterest": obj.get("industryOfInterest"), + "assetClassesOfInterest": obj.get("assetClassesOfInterest"), + "marketCoverage": obj.get("marketCoverage"), + "responsibility": obj.get("responsibility"), + "function": obj.get("function"), + "instrument": obj.get("instrument") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.display_name: str = None - self.company_name: str = None - self.email: str = None - self.mobile: str = None - self.job_title: str = None - self.job_role: str = None - self.job_department: str = None - self.job_division: str = None - self.job_phone: str = None - self.job_city: str = None - self.industry_of_interest: List[str] = None - self.asset_classes_of_interest: List[str] = None - self.market_coverage: List[str] = None - self.responsibility: List[str] = None - self.function: List[str] = None - self.instrument: List[str] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/base_type.py b/symphony/bdk/gen/group_model/base_type.py index abcf429b..777eb7a7 100644 --- a/symphony/bdk/gen/group_model/base_type.py +++ b/symphony/bdk/gen/group_model/base_type.py @@ -1,276 +1,95 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.group_model.owner import Owner from symphony.bdk.gen.group_model.status import Status -globals()['Owner'] = Owner -globals()['Status'] = Status +from typing import Optional, Set +from typing_extensions import Self -class BaseType(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class BaseType(BaseModel): """ + A reduced set Type object, for retrieving list of types purpose + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Type identifier") + owner_type: Optional[Owner] = Field(default=None, alias="ownerType") + name: Optional[StrictStr] = Field(default=None, description="Type's name") + status: Optional[Status] = None + __properties: ClassVar[List[str]] = ["id", "ownerType", "name", "status"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BaseType from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (str, none_type), # noqa: E501 - 'owner_type': (Owner, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'status': (Status, none_type), # noqa: E501 - } + excluded_fields: Set[str] = set([ + ]) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'owner_type': 'ownerType', # noqa: E501 - 'name': 'name', # noqa: E501 - 'status': 'status', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """BaseType - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Type identifier. [optional] # noqa: E501 - owner_type (Owner): [optional] # noqa: E501 - name (str): Type's name. [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """BaseType - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Type identifier. [optional] # noqa: E501 - owner_type (Owner): [optional] # noqa: E501 - name (str): Type's name. [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BaseType from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "ownerType": obj.get("ownerType"), + "name": obj.get("name"), + "status": obj.get("status") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.owner_type: Owner = None - self.name: str = None - self.status: Status = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/create_group.py b/symphony/bdk/gen/group_model/create_group.py index 55f7c7a6..57ccbe38 100644 --- a/symphony/bdk/gen/group_model/create_group.py +++ b/symphony/bdk/gen/group_model/create_group.py @@ -1,382 +1,143 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.group_model.base_group import BaseGroup +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.group_model.base_profile import BaseProfile -from symphony.bdk.gen.group_model.create_group_all_of import CreateGroupAllOf from symphony.bdk.gen.group_model.group_implicit_connection import GroupImplicitConnection from symphony.bdk.gen.group_model.group_interaction_transfer import GroupInteractionTransfer from symphony.bdk.gen.group_model.group_visibility_restriction import GroupVisibilityRestriction from symphony.bdk.gen.group_model.member import Member from symphony.bdk.gen.group_model.owner import Owner -globals()['BaseGroup'] = BaseGroup -globals()['BaseProfile'] = BaseProfile -globals()['CreateGroupAllOf'] = CreateGroupAllOf -globals()['GroupImplicitConnection'] = GroupImplicitConnection -globals()['GroupInteractionTransfer'] = GroupInteractionTransfer -globals()['GroupVisibilityRestriction'] = GroupVisibilityRestriction -globals()['Member'] = Member -globals()['Owner'] = Owner - -class CreateGroup(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class CreateGroup(BaseModel): """ - - allowed_values = { - ('sub_type',): { - 'COMMUNITY': "COMMUNITY", - 'CHANNEL': "CHANNEL", - }, - } - - validations = { - ('type',): { - 'min_length': 1, - }, - ('name',): { - 'min_length': 1, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str,), # noqa: E501 - 'owner_type': (Owner,), # noqa: E501 - 'owner_id': (int,), # noqa: E501 - 'name': (str,), # noqa: E501 - 'sub_type': (str, none_type), # noqa: E501 - 'referrer': (str, none_type), # noqa: E501 - 'members': ([Member], none_type), # noqa: E501 - 'profile': (BaseProfile, none_type), # noqa: E501 - 'visibility_restriction': (GroupVisibilityRestriction, none_type), # noqa: E501 - 'implicit_connection': (GroupImplicitConnection, none_type), # noqa: E501 - 'interaction_transfer': (GroupInteractionTransfer, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'type': 'type', # noqa: E501 - 'owner_type': 'ownerType', # noqa: E501 - 'owner_id': 'ownerId', # noqa: E501 - 'name': 'name', # noqa: E501 - 'sub_type': 'subType', # noqa: E501 - 'referrer': 'referrer', # noqa: E501 - 'members': 'members', # noqa: E501 - 'profile': 'profile', # noqa: E501 - 'visibility_restriction': 'visibilityRestriction', # noqa: E501 - 'implicit_connection': 'implicitConnection', # noqa: E501 - 'interaction_transfer': 'interactionTransfer', # noqa: E501 - } - - read_only_vars = { - } + CreateGroup + """ # noqa: E501 + type: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Group type identifier") + owner_type: Owner = Field(alias="ownerType") + owner_id: StrictInt = Field(description="Owner id if the owner type is tenant (podId) or user (userId), otherwise null", alias="ownerId") + name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Group's name") + sub_type: Optional[StrictStr] = Field(default=None, description="The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List", alias="subType") + referrer: Optional[StrictStr] = Field(default=None, description="The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List") + members: Optional[List[Member]] = None + profile: Optional[BaseProfile] = None + visibility_restriction: Optional[GroupVisibilityRestriction] = Field(default=None, alias="visibilityRestriction") + implicit_connection: Optional[GroupImplicitConnection] = Field(default=None, alias="implicitConnection") + interaction_transfer: Optional[GroupInteractionTransfer] = Field(default=None, alias="interactionTransfer") + __properties: ClassVar[List[str]] = ["type", "ownerType", "ownerId", "name", "subType", "referrer", "members", "profile", "visibilityRestriction", "implicitConnection", "interactionTransfer"] + + @field_validator('sub_type') + def sub_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['COMMUNITY', 'CHANNEL']): + raise ValueError("must be one of enum values ('COMMUNITY', 'CHANNEL')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """CreateGroup - a group_model defined in OpenAPI - - Keyword Args: - type (str): Group type identifier - owner_type (Owner): - owner_id (int): Owner id if the owner type is tenant (podId) or user (userId), otherwise null - name (str): Group's name - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - sub_type (str): The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - referrer (str): The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - members ([Member]): [optional] # noqa: E501 - profile (BaseProfile): [optional] # noqa: E501 - visibility_restriction (GroupVisibilityRestriction): [optional] # noqa: E501 - implicit_connection (GroupImplicitConnection): [optional] # noqa: E501 - interaction_transfer (GroupInteractionTransfer): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateGroup from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """CreateGroup - a group_model defined in OpenAPI - - Keyword Args: - type (str): Group type identifier - owner_type (Owner): - owner_id (int): Owner id if the owner type is tenant (podId) or user (userId), otherwise null - name (str): Group's name - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - sub_type (str): The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - referrer (str): The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - members ([Member]): [optional] # noqa: E501 - profile (BaseProfile): [optional] # noqa: E501 - visibility_restriction (GroupVisibilityRestriction): [optional] # noqa: E501 - implicit_connection (GroupImplicitConnection): [optional] # noqa: E501 - interaction_transfer (GroupInteractionTransfer): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in members (list) + _items = [] + if self.members: + for _item_members in self.members: + if _item_members: + _items.append(_item_members.to_dict()) + _dict['members'] = _items + # override the default output from pydantic by calling `to_dict()` of profile + if self.profile: + _dict['profile'] = self.profile.to_dict() + # override the default output from pydantic by calling `to_dict()` of visibility_restriction + if self.visibility_restriction: + _dict['visibilityRestriction'] = self.visibility_restriction.to_dict() + # override the default output from pydantic by calling `to_dict()` of implicit_connection + if self.implicit_connection: + _dict['implicitConnection'] = self.implicit_connection.to_dict() + # override the default output from pydantic by calling `to_dict()` of interaction_transfer + if self.interaction_transfer: + _dict['interactionTransfer'] = self.interaction_transfer.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateGroup from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "ownerType": obj.get("ownerType"), + "ownerId": obj.get("ownerId"), + "name": obj.get("name"), + "subType": obj.get("subType"), + "referrer": obj.get("referrer"), + "members": [Member.from_dict(_item) for _item in obj["members"]] if obj.get("members") is not None else None, + "profile": BaseProfile.from_dict(obj["profile"]) if obj.get("profile") is not None else None, + "visibilityRestriction": GroupVisibilityRestriction.from_dict(obj["visibilityRestriction"]) if obj.get("visibilityRestriction") is not None else None, + "implicitConnection": GroupImplicitConnection.from_dict(obj["implicitConnection"]) if obj.get("implicitConnection") is not None else None, + "interactionTransfer": GroupInteractionTransfer.from_dict(obj["interactionTransfer"]) if obj.get("interactionTransfer") is not None else None + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.type: str = kwargs['type'] - self.owner_type: Owner = kwargs['owner_type'] - self.owner_id: int = kwargs['owner_id'] - self.name: str = kwargs['name'] - self.sub_type: str = None - self.referrer: str = None - self.members: List[Member] = None - self.profile: BaseProfile = None - self.visibility_restriction: GroupVisibilityRestriction = None - self.implicit_connection: GroupImplicitConnection = None - self.interaction_transfer: GroupInteractionTransfer = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - BaseGroup, - CreateGroupAllOf, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/group_model/create_group_all_of.py b/symphony/bdk/gen/group_model/create_group_all_of.py deleted file mode 100644 index a004376a..00000000 --- a/symphony/bdk/gen/group_model/create_group_all_of.py +++ /dev/null @@ -1,301 +0,0 @@ -""" - Symphony Profile Manager - - Profile Manager is a microservice to manage users profile and groups # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.group_model.base_profile import BaseProfile -from symphony.bdk.gen.group_model.group_implicit_connection import GroupImplicitConnection -from symphony.bdk.gen.group_model.group_interaction_transfer import GroupInteractionTransfer -from symphony.bdk.gen.group_model.group_visibility_restriction import GroupVisibilityRestriction -from symphony.bdk.gen.group_model.member import Member -globals()['BaseProfile'] = BaseProfile -globals()['GroupImplicitConnection'] = GroupImplicitConnection -globals()['GroupInteractionTransfer'] = GroupInteractionTransfer -globals()['GroupVisibilityRestriction'] = GroupVisibilityRestriction -globals()['Member'] = Member - -class CreateGroupAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('sub_type',): { - 'COMMUNITY': "COMMUNITY", - 'CHANNEL': "CHANNEL", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'sub_type': (str, none_type), # noqa: E501 - 'referrer': (str, none_type), # noqa: E501 - 'members': ([Member], none_type), # noqa: E501 - 'profile': (BaseProfile, none_type), # noqa: E501 - 'visibility_restriction': (GroupVisibilityRestriction, none_type), # noqa: E501 - 'implicit_connection': (GroupImplicitConnection, none_type), # noqa: E501 - 'interaction_transfer': (GroupInteractionTransfer, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'sub_type': 'subType', # noqa: E501 - 'referrer': 'referrer', # noqa: E501 - 'members': 'members', # noqa: E501 - 'profile': 'profile', # noqa: E501 - 'visibility_restriction': 'visibilityRestriction', # noqa: E501 - 'implicit_connection': 'implicitConnection', # noqa: E501 - 'interaction_transfer': 'interactionTransfer', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """CreateGroupAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - sub_type (str): The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - referrer (str): The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - members ([Member]): [optional] # noqa: E501 - profile (BaseProfile): [optional] # noqa: E501 - visibility_restriction (GroupVisibilityRestriction): [optional] # noqa: E501 - implicit_connection (GroupImplicitConnection): [optional] # noqa: E501 - interaction_transfer (GroupInteractionTransfer): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """CreateGroupAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - sub_type (str): The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - referrer (str): The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - members ([Member]): [optional] # noqa: E501 - profile (BaseProfile): [optional] # noqa: E501 - visibility_restriction (GroupVisibilityRestriction): [optional] # noqa: E501 - implicit_connection (GroupImplicitConnection): [optional] # noqa: E501 - interaction_transfer (GroupInteractionTransfer): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.sub_type: str = None - self.referrer: str = None - self.members: List[Member] = None - self.profile: BaseProfile = None - self.visibility_restriction: GroupVisibilityRestriction = None - self.implicit_connection: GroupImplicitConnection = None - self.interaction_transfer: GroupInteractionTransfer = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/error.py b/symphony/bdk/gen/group_model/error.py index c47a26fe..e7080e30 100644 --- a/symphony/bdk/gen/group_model/error.py +++ b/symphony/bdk/gen/group_model/error.py @@ -1,277 +1,93 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class Error(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class Error(BaseModel): """ + Common error response body + """ # noqa: E501 + code: StrictStr = Field(description="An internal code that can be used by support/developers to quickly locate the line of code that generated the error response.") + message: StrictStr = Field(description="A human-readable error message") + context: Optional[Dict[str, StrictStr]] = Field(default=None, description="A name-value map of variables and their value necessary to construct the message") + details: Optional[Dict[str, Any]] = Field(default=None, description="Additional data that might be included") + __properties: ClassVar[List[str]] = ["code", "message", "context", "details"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Error from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'code': (str,), # noqa: E501 - 'message': (str,), # noqa: E501 - 'context': ({str: (str,)}, none_type), # noqa: E501 - 'details': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - + excluded_fields: Set[str] = set([ + ]) - attribute_map = { - 'code': 'code', # noqa: E501 - 'message': 'message', # noqa: E501 - 'context': 'context', # noqa: E501 - 'details': 'details', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, code, message, *args, **kwargs): # noqa: E501 - """Error - a group_model defined in OpenAPI - - Args: - code (str): An internal code that can be used by support/developers to quickly locate the line of code that generated the error response. - message (str): A human-readable error message - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - context ({str: (str,)}): A name-value map of variables and their value necessary to construct the message. [optional] # noqa: E501 - details ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Additional data that might be included. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.code = code - self.message = message - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, code, message, *args, **kwargs): # noqa: E501 - """Error - a group_model defined in OpenAPI - - Args: - code (str): An internal code that can be used by support/developers to quickly locate the line of code that generated the error response. - message (str): A human-readable error message - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - context ({str: (str,)}): A name-value map of variables and their value necessary to construct the message. [optional] # noqa: E501 - details ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Additional data that might be included. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Error from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "context": obj.get("context"), + "details": obj.get("details") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.code: str = code - self.message: str = message - self.context: Union[{str: (str,)}] = None - self.details: Union[{str: (bool, date, datetime, dict, float, int, list, str, none_type)}] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/group_implicit_connection.py b/symphony/bdk/gen/group_model/group_implicit_connection.py index 256c8df1..86b640e0 100644 --- a/symphony/bdk/gen/group_model/group_implicit_connection.py +++ b/symphony/bdk/gen/group_model/group_implicit_connection.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class GroupImplicitConnection(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'connected_tenants_list': ([int], none_type), # noqa: E501 - 'connected_users_list': ([int], none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class GroupImplicitConnection(BaseModel): + """ + Group implicit connections. + """ # noqa: E501 + connected_tenants_list: Optional[List[StrictInt]] = Field(default=None, alias="connectedTenantsList") + connected_users_list: Optional[List[StrictInt]] = Field(default=None, alias="connectedUsersList") + __properties: ClassVar[List[str]] = ["connectedTenantsList", "connectedUsersList"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'connected_tenants_list': 'connectedTenantsList', # noqa: E501 - 'connected_users_list': 'connectedUsersList', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """GroupImplicitConnection - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - connected_tenants_list ([int]): [optional] # noqa: E501 - connected_users_list ([int]): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GroupImplicitConnection from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """GroupImplicitConnection - a group_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - connected_tenants_list ([int]): [optional] # noqa: E501 - connected_users_list ([int]): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GroupImplicitConnection from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "connectedTenantsList": obj.get("connectedTenantsList"), + "connectedUsersList": obj.get("connectedUsersList") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.connected_tenants_list: List[int] = None - self.connected_users_list: List[int] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/group_interaction_transfer.py b/symphony/bdk/gen/group_model/group_interaction_transfer.py index 7fbbdd64..e5d55b7e 100644 --- a/symphony/bdk/gen/group_model/group_interaction_transfer.py +++ b/symphony/bdk/gen/group_model/group_interaction_transfer.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class GroupInteractionTransfer(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'restricted_tenants_list': ([int], none_type), # noqa: E501 - 'restricted_users_list': ([int], none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class GroupInteractionTransfer(BaseModel): + """ + Group interaction transfer. + """ # noqa: E501 + restricted_tenants_list: Optional[List[StrictInt]] = Field(default=None, alias="restrictedTenantsList") + restricted_users_list: Optional[List[StrictInt]] = Field(default=None, alias="restrictedUsersList") + __properties: ClassVar[List[str]] = ["restrictedTenantsList", "restrictedUsersList"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'restricted_tenants_list': 'restrictedTenantsList', # noqa: E501 - 'restricted_users_list': 'restrictedUsersList', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """GroupInteractionTransfer - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - restricted_tenants_list ([int]): [optional] # noqa: E501 - restricted_users_list ([int]): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GroupInteractionTransfer from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """GroupInteractionTransfer - a group_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - restricted_tenants_list ([int]): [optional] # noqa: E501 - restricted_users_list ([int]): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GroupInteractionTransfer from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "restrictedTenantsList": obj.get("restrictedTenantsList"), + "restrictedUsersList": obj.get("restrictedUsersList") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.restricted_tenants_list: List[int] = None - self.restricted_users_list: List[int] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/group_list.py b/symphony/bdk/gen/group_model/group_list.py index 0f998959..5e194691 100644 --- a/symphony/bdk/gen/group_model/group_list.py +++ b/symphony/bdk/gen/group_model/group_list.py @@ -1,266 +1,101 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.group_model.pagination import Pagination from symphony.bdk.gen.group_model.read_group import ReadGroup -globals()['Pagination'] = Pagination -globals()['ReadGroup'] = ReadGroup +from typing import Optional, Set +from typing_extensions import Self -class GroupList(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class GroupList(BaseModel): """ + GroupList + """ # noqa: E501 + pagination: Optional[Pagination] = None + data: Optional[List[ReadGroup]] = None + __properties: ClassVar[List[str]] = ["pagination", "data"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'pagination': (Pagination, none_type), # noqa: E501 - 'data': ([ReadGroup], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'pagination': 'pagination', # noqa: E501 - 'data': 'data', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """GroupList - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pagination (Pagination): [optional] # noqa: E501 - data ([ReadGroup]): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GroupList from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """GroupList - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pagination (Pagination): [optional] # noqa: E501 - data ([ReadGroup]): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GroupList from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None, + "data": [ReadGroup.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.pagination: Pagination = None - self.data: List[ReadGroup] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/group_visibility_restriction.py b/symphony/bdk/gen/group_model/group_visibility_restriction.py index ac3af7ab..82ce19c8 100644 --- a/symphony/bdk/gen/group_model/group_visibility_restriction.py +++ b/symphony/bdk/gen/group_model/group_visibility_restriction.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class GroupVisibilityRestriction(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'restricted_tenants_list': ([int], none_type), # noqa: E501 - 'restricted_users_list': ([int], none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class GroupVisibilityRestriction(BaseModel): + """ + Group visibility restriction. + """ # noqa: E501 + restricted_tenants_list: Optional[List[StrictInt]] = Field(default=None, alias="restrictedTenantsList") + restricted_users_list: Optional[List[StrictInt]] = Field(default=None, alias="restrictedUsersList") + __properties: ClassVar[List[str]] = ["restrictedTenantsList", "restrictedUsersList"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'restricted_tenants_list': 'restrictedTenantsList', # noqa: E501 - 'restricted_users_list': 'restrictedUsersList', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """GroupVisibilityRestriction - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - restricted_tenants_list ([int]): [optional] # noqa: E501 - restricted_users_list ([int]): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GroupVisibilityRestriction from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """GroupVisibilityRestriction - a group_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - restricted_tenants_list ([int]): [optional] # noqa: E501 - restricted_users_list ([int]): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GroupVisibilityRestriction from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "restrictedTenantsList": obj.get("restrictedTenantsList"), + "restrictedUsersList": obj.get("restrictedUsersList") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.restricted_tenants_list: List[int] = None - self.restricted_users_list: List[int] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/implicit_connection.py b/symphony/bdk/gen/group_model/implicit_connection.py index d331a369..9b5b85f2 100644 --- a/symphony/bdk/gen/group_model/implicit_connection.py +++ b/symphony/bdk/gen/group_model/implicit_connection.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class ImplicitConnection(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'all': (bool, none_type), # noqa: E501 - 'connect_to_tenants': (bool, none_type), # noqa: E501 - 'connect_to_users': (bool, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class ImplicitConnection(BaseModel): + """ + ImplicitConnection + """ # noqa: E501 + all: Optional[StrictBool] = None + connect_to_tenants: Optional[StrictBool] = Field(default=None, description="Not supported yet", alias="connectToTenants") + connect_to_users: Optional[StrictBool] = Field(default=None, description="Not supported yet", alias="connectToUsers") + __properties: ClassVar[List[str]] = ["all", "connectToTenants", "connectToUsers"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'all': 'all', # noqa: E501 - 'connect_to_tenants': 'connectToTenants', # noqa: E501 - 'connect_to_users': 'connectToUsers', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ImplicitConnection - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - all (bool): [optional] # noqa: E501 - connect_to_tenants (bool): Not supported yet. [optional] # noqa: E501 - connect_to_users (bool): Not supported yet. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ImplicitConnection from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ImplicitConnection - a group_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - all (bool): [optional] # noqa: E501 - connect_to_tenants (bool): Not supported yet. [optional] # noqa: E501 - connect_to_users (bool): Not supported yet. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ImplicitConnection from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "all": obj.get("all"), + "connectToTenants": obj.get("connectToTenants"), + "connectToUsers": obj.get("connectToUsers") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.all: bool = None - self.connect_to_tenants: bool = None - self.connect_to_users: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/interaction_control.py b/symphony/bdk/gen/group_model/interaction_control.py index 0249f27f..e59ae8ea 100644 --- a/symphony/bdk/gen/group_model/interaction_control.py +++ b/symphony/bdk/gen/group_model/interaction_control.py @@ -1,279 +1,99 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.group_model.interaction_transfer import InteractionTransfer -globals()['InteractionTransfer'] = InteractionTransfer - -class InteractionControl(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class InteractionControl(BaseModel): """ + InteractionControl + """ # noqa: E501 + allow_ims: Optional[StrictBool] = Field(default=None, alias="allowIMs") + allow_rooms: Optional[StrictBool] = Field(default=None, alias="allowRooms") + interaction_transfer: Optional[InteractionTransfer] = Field(default=None, alias="interactionTransfer") + tag_stream: Optional[StrictStr] = Field(default=None, alias="tagStream") + can_have_interaction: Optional[StrictBool] = Field(default=True, description="For the SDL groupe type this flag is true, for the company groupe type it is false", alias="canHaveInteraction") + __properties: ClassVar[List[str]] = ["allowIMs", "allowRooms", "interactionTransfer", "tagStream", "canHaveInteraction"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InteractionControl from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'allow_ims': (bool, none_type), # noqa: E501 - 'allow_rooms': (bool, none_type), # noqa: E501 - 'interaction_transfer': (InteractionTransfer, none_type), # noqa: E501 - 'tag_stream': (str, none_type), # noqa: E501 - 'can_have_interaction': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'allow_ims': 'allowIMs', # noqa: E501 - 'allow_rooms': 'allowRooms', # noqa: E501 - 'interaction_transfer': 'interactionTransfer', # noqa: E501 - 'tag_stream': 'tagStream', # noqa: E501 - 'can_have_interaction': 'canHaveInteraction', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of interaction_transfer + if self.interaction_transfer: + _dict['interactionTransfer'] = self.interaction_transfer.to_dict() + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """InteractionControl - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - allow_ims (bool): [optional] # noqa: E501 - allow_rooms (bool): [optional] # noqa: E501 - interaction_transfer (InteractionTransfer): [optional] # noqa: E501 - tag_stream (str): [optional] # noqa: E501 - can_have_interaction (bool): For the SDL groupe type this flag is true, for the company groupe type it is false. [optional] if omitted the server will use the default value of True # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """InteractionControl - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - allow_ims (bool): [optional] # noqa: E501 - allow_rooms (bool): [optional] # noqa: E501 - interaction_transfer (InteractionTransfer): [optional] # noqa: E501 - tag_stream (str): [optional] # noqa: E501 - can_have_interaction (bool): For the SDL groupe type this flag is true, for the company groupe type it is false. [optional] if omitted the server will use the default value of True # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InteractionControl from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "allowIMs": obj.get("allowIMs"), + "allowRooms": obj.get("allowRooms"), + "interactionTransfer": InteractionTransfer.from_dict(obj["interactionTransfer"]) if obj.get("interactionTransfer") is not None else None, + "tagStream": obj.get("tagStream"), + "canHaveInteraction": obj.get("canHaveInteraction") if obj.get("canHaveInteraction") is not None else True + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.allow_ims: bool = None - self.allow_rooms: bool = None - self.interaction_transfer: InteractionTransfer = None - self.tag_stream: str = None - self.can_have_interaction: bool = True - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/interaction_transfer.py b/symphony/bdk/gen/group_model/interaction_transfer.py index 8fc555c3..4b8d6e01 100644 --- a/symphony/bdk/gen/group_model/interaction_transfer.py +++ b/symphony/bdk/gen/group_model/interaction_transfer.py @@ -1,284 +1,109 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.group_model.transfer_view import TransferView -globals()['TransferView'] = TransferView - -class InteractionTransfer(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class InteractionTransfer(BaseModel): """ + InteractionTransfer + """ # noqa: E501 + target: Optional[StrictStr] = Field(default=None, description="Only TO_MEMBERS supported now") + update_interaction_ongroup_update: Optional[StrictBool] = Field(default=None, alias="updateInteractionOngroupUpdate") + system_message_on_interaction: Optional[StrictBool] = Field(default=None, description="Not supported yet", alias="systemMessageOnInteraction") + transfer_view: Optional[TransferView] = Field(default=None, alias="transferView") + audit_transfer: Optional[StrictBool] = Field(default=None, alias="auditTransfer") + __properties: ClassVar[List[str]] = ["target", "updateInteractionOngroupUpdate", "systemMessageOnInteraction", "transferView", "auditTransfer"] + + @field_validator('target') + def target_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['TO_USER', 'TO_MEMBERS', 'NONE']): + raise ValueError("must be one of enum values ('TO_USER', 'TO_MEMBERS', 'NONE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('target',): { - 'TO_USER': "TO_USER", - 'TO_MEMBERS': "TO_MEMBERS", - 'NONE': "NONE", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InteractionTransfer from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'target': (str, none_type), # noqa: E501 - 'update_interaction_ongroup_update': (bool, none_type), # noqa: E501 - 'system_message_on_interaction': (bool, none_type), # noqa: E501 - 'transfer_view': (TransferView, none_type), # noqa: E501 - 'audit_transfer': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'target': 'target', # noqa: E501 - 'update_interaction_ongroup_update': 'updateInteractionOngroupUpdate', # noqa: E501 - 'system_message_on_interaction': 'systemMessageOnInteraction', # noqa: E501 - 'transfer_view': 'transferView', # noqa: E501 - 'audit_transfer': 'auditTransfer', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of transfer_view + if self.transfer_view: + _dict['transferView'] = self.transfer_view.to_dict() + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """InteractionTransfer - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - target (str): Only TO_MEMBERS supported now. [optional] # noqa: E501 - update_interaction_ongroup_update (bool): [optional] # noqa: E501 - system_message_on_interaction (bool): Not supported yet. [optional] # noqa: E501 - transfer_view (TransferView): [optional] # noqa: E501 - audit_transfer (bool): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """InteractionTransfer - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - target (str): Only TO_MEMBERS supported now. [optional] # noqa: E501 - update_interaction_ongroup_update (bool): [optional] # noqa: E501 - system_message_on_interaction (bool): Not supported yet. [optional] # noqa: E501 - transfer_view (TransferView): [optional] # noqa: E501 - audit_transfer (bool): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InteractionTransfer from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "target": obj.get("target"), + "updateInteractionOngroupUpdate": obj.get("updateInteractionOngroupUpdate"), + "systemMessageOnInteraction": obj.get("systemMessageOnInteraction"), + "transferView": TransferView.from_dict(obj["transferView"]) if obj.get("transferView") is not None else None, + "auditTransfer": obj.get("auditTransfer") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.target: str = None - self.update_interaction_ongroup_update: bool = None - self.system_message_on_interaction: bool = None - self.transfer_view: TransferView = None - self.audit_transfer: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/member.py b/symphony/bdk/gen/group_model/member.py index 6c31a15b..c307f403 100644 --- a/symphony/bdk/gen/group_model/member.py +++ b/symphony/bdk/gen/group_model/member.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Member(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'member_tenant': (int, none_type), # noqa: E501 - 'member_id': (int, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Member(BaseModel): + """ + A Group member. + """ # noqa: E501 + member_tenant: Optional[StrictInt] = Field(default=None, description="Member's tenant id", alias="memberTenant") + member_id: Optional[StrictInt] = Field(default=None, description="Member's user id", alias="memberId") + __properties: ClassVar[List[str]] = ["memberTenant", "memberId"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'member_tenant': 'memberTenant', # noqa: E501 - 'member_id': 'memberId', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Member - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - member_tenant (int): Member's tenant id. [optional] # noqa: E501 - member_id (int): Member's user id. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Member from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Member - a group_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - member_tenant (int): Member's tenant id. [optional] # noqa: E501 - member_id (int): Member's user id. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Member from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "memberTenant": obj.get("memberTenant"), + "memberId": obj.get("memberId") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.member_tenant: int = None - self.member_id: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/membership_control.py b/symphony/bdk/gen/group_model/membership_control.py index 50ada17d..6f5933a7 100644 --- a/symphony/bdk/gen/group_model/membership_control.py +++ b/symphony/bdk/gen/group_model/membership_control.py @@ -1,283 +1,97 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class MembershipControl(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class MembershipControl(BaseModel): """ + MembershipControl + """ # noqa: E501 + entitlements: Optional[List[StrictStr]] = None + manual_membership: Optional[StrictBool] = Field(default=None, alias="manualMembership") + rule_membership: Optional[StrictBool] = Field(default=None, description="Not supported yet", alias="ruleMembership") + update_membership_on_rule_update: Optional[StrictBool] = Field(default=None, description="Not supported yet", alias="updateMembershipOnRuleUpdate") + notify_members_on_update: Optional[StrictBool] = Field(default=None, alias="notifyMembersOnUpdate") + can_belong_to_multiple_group: Optional[StrictBool] = Field(default=True, description="For the SDL groupe type this flag is true, for the company groupe type it is false", alias="canBelongToMultipleGroup") + __properties: ClassVar[List[str]] = ["entitlements", "manualMembership", "ruleMembership", "updateMembershipOnRuleUpdate", "notifyMembersOnUpdate", "canBelongToMultipleGroup"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - ('entitlements',): { - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MembershipControl from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'entitlements': ([str], none_type), # noqa: E501 - 'manual_membership': (bool, none_type), # noqa: E501 - 'rule_membership': (bool, none_type), # noqa: E501 - 'update_membership_on_rule_update': (bool, none_type), # noqa: E501 - 'notify_members_on_update': (bool, none_type), # noqa: E501 - 'can_belong_to_multiple_group': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'entitlements': 'entitlements', # noqa: E501 - 'manual_membership': 'manualMembership', # noqa: E501 - 'rule_membership': 'ruleMembership', # noqa: E501 - 'update_membership_on_rule_update': 'updateMembershipOnRuleUpdate', # noqa: E501 - 'notify_members_on_update': 'notifyMembersOnUpdate', # noqa: E501 - 'can_belong_to_multiple_group': 'canBelongToMultipleGroup', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MembershipControl - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - entitlements ([str]): [optional] # noqa: E501 - manual_membership (bool): [optional] # noqa: E501 - rule_membership (bool): Not supported yet. [optional] # noqa: E501 - update_membership_on_rule_update (bool): Not supported yet. [optional] # noqa: E501 - notify_members_on_update (bool): [optional] # noqa: E501 - can_belong_to_multiple_group (bool): For the SDL groupe type this flag is true, for the company groupe type it is false. [optional] if omitted the server will use the default value of True # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MembershipControl - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - entitlements ([str]): [optional] # noqa: E501 - manual_membership (bool): [optional] # noqa: E501 - rule_membership (bool): Not supported yet. [optional] # noqa: E501 - update_membership_on_rule_update (bool): Not supported yet. [optional] # noqa: E501 - notify_members_on_update (bool): [optional] # noqa: E501 - can_belong_to_multiple_group (bool): For the SDL groupe type this flag is true, for the company groupe type it is false. [optional] if omitted the server will use the default value of True # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MembershipControl from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "entitlements": obj.get("entitlements"), + "manualMembership": obj.get("manualMembership"), + "ruleMembership": obj.get("ruleMembership"), + "updateMembershipOnRuleUpdate": obj.get("updateMembershipOnRuleUpdate"), + "notifyMembersOnUpdate": obj.get("notifyMembersOnUpdate"), + "canBelongToMultipleGroup": obj.get("canBelongToMultipleGroup") if obj.get("canBelongToMultipleGroup") is not None else True + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.entitlements: List[str] = None - self.manual_membership: bool = None - self.rule_membership: bool = None - self.update_membership_on_rule_update: bool = None - self.notify_members_on_update: bool = None - self.can_belong_to_multiple_group: bool = True - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/owner.py b/symphony/bdk/gen/group_model/owner.py index 1891bde7..7ddf4184 100644 --- a/symphony/bdk/gen/group_model/owner.py +++ b/symphony/bdk/gen/group_model/owner.py @@ -1,283 +1,38 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Owner(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('value',): { - 'PLATFORM': "PLATFORM", - 'TENANT': "TENANT", - 'USER': "USER", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': (str,), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - _composed_schemas = None +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """Owner - a group_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Owner type. Ony TENANT supported now., must be one of ["PLATFORM", "TENANT", "USER", ] # noqa: E501 - - Keyword Args: - value (str): Owner type. Ony TENANT supported now., must be one of ["PLATFORM", "TENANT", "USER", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) +class Owner(str, Enum): + """ + Owner type. Ony TENANT supported now + """ - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: str = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + """ + allowed enum values + """ + PLATFORM = 'PLATFORM' + TENANT = 'TENANT' + USER = 'USER' @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """Owner - a group_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Owner type. Ony TENANT supported now., must be one of ["PLATFORM", "TENANT", "USER", ] # noqa: E501 - - Keyword Args: - value (str): Owner type. Ony TENANT supported now., must be one of ["PLATFORM", "TENANT", "USER", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Self: + """Create an instance of Owner from a JSON string""" + return cls(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - return self diff --git a/symphony/bdk/gen/group_model/pagination.py b/symphony/bdk/gen/group_model/pagination.py index a4042345..ec2767b3 100644 --- a/symphony/bdk/gen/group_model/pagination.py +++ b/symphony/bdk/gen/group_model/pagination.py @@ -1,274 +1,95 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.group_model.pagination_cursors import PaginationCursors -globals()['PaginationCursors'] = PaginationCursors - -class Pagination(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class Pagination(BaseModel): """ + Pagination information + """ # noqa: E501 + previous: Optional[StrictStr] = Field(default=None, description="Path to retrieve the previous page of data. If not present, the current page is the first page of data.") + next: Optional[StrictStr] = Field(default=None, description="Path to retrieve the next page of data. If not present, the current page is the last page of data.") + cursors: PaginationCursors + __properties: ClassVar[List[str]] = ["previous", "next", "cursors"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'cursors': (PaginationCursors,), # noqa: E501 - 'previous': (str, none_type), # noqa: E501 - 'next': (str, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'cursors': 'cursors', # noqa: E501 - 'previous': 'previous', # noqa: E501 - 'next': 'next', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, cursors, *args, **kwargs): # noqa: E501 - """Pagination - a group_model defined in OpenAPI - - Args: - cursors (PaginationCursors): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - previous (str): Path to retrieve the previous page of data. If not present, the current page is the first page of data.. [optional] # noqa: E501 - next (str): Path to retrieve the next page of data. If not present, the current page is the last page of data.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Pagination from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.cursors = cursors - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, cursors, *args, **kwargs): # noqa: E501 - """Pagination - a group_model defined in OpenAPI - - Args: - cursors (PaginationCursors): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - previous (str): Path to retrieve the previous page of data. If not present, the current page is the first page of data.. [optional] # noqa: E501 - next (str): Path to retrieve the next page of data. If not present, the current page is the last page of data.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of cursors + if self.cursors: + _dict['cursors'] = self.cursors.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Pagination from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "previous": obj.get("previous"), + "next": obj.get("next"), + "cursors": PaginationCursors.from_dict(obj["cursors"]) if obj.get("cursors") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.cursors: PaginationCursors = cursors - self.previous: str = None - self.next: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/pagination_cursors.py b/symphony/bdk/gen/group_model/pagination_cursors.py index 40f865b4..fc5bd715 100644 --- a/symphony/bdk/gen/group_model/pagination_cursors.py +++ b/symphony/bdk/gen/group_model/pagination_cursors.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class PaginationCursors(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'before': (str, none_type), # noqa: E501 - 'after': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class PaginationCursors(BaseModel): + """ + Cursors for pagination + """ # noqa: E501 + before: Optional[StrictStr] = Field(default=None, description="Cursor that points to the start of the current page of data. If not present, the current page is the first page.") + after: Optional[StrictStr] = Field(default=None, description="Cursor that points to the end of the current page of data. If not present, the current page is the last page.") + __properties: ClassVar[List[str]] = ["before", "after"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'before': 'before', # noqa: E501 - 'after': 'after', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """PaginationCursors - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - before (str): Cursor that points to the start of the current page of data. If not present, the current page is the first page.. [optional] # noqa: E501 - after (str): Cursor that points to the end of the current page of data. If not present, the current page is the last page.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PaginationCursors from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """PaginationCursors - a group_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - before (str): Cursor that points to the start of the current page of data. If not present, the current page is the first page.. [optional] # noqa: E501 - after (str): Cursor that points to the end of the current page of data. If not present, the current page is the last page.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaginationCursors from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "before": obj.get("before"), + "after": obj.get("after") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.before: str = None - self.after: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/profile.py b/symphony/bdk/gen/group_model/profile.py index df1042b5..78573d58 100644 --- a/symphony/bdk/gen/group_model/profile.py +++ b/symphony/bdk/gen/group_model/profile.py @@ -1,408 +1,130 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.group_model.avatar import Avatar -from symphony.bdk.gen.group_model.base_profile import BaseProfile -from symphony.bdk.gen.group_model.profile_all_of import ProfileAllOf -globals()['Avatar'] = Avatar -globals()['BaseProfile'] = BaseProfile -globals()['ProfileAllOf'] = ProfileAllOf - -class Profile(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class Profile(BaseModel): """ - - allowed_values = { - } - - validations = { - ('display_name',): { - 'min_length': 1, - }, - ('market_coverage',): { - }, - ('responsibility',): { - }, - ('function',): { - }, - ('instrument',): { - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'display_name': (str, none_type), # noqa: E501 - 'company_name': (str, none_type), # noqa: E501 - 'email': (str, none_type), # noqa: E501 - 'mobile': (str, none_type), # noqa: E501 - 'job_title': (str, none_type), # noqa: E501 - 'job_role': (str, none_type), # noqa: E501 - 'job_department': (str, none_type), # noqa: E501 - 'job_division': (str, none_type), # noqa: E501 - 'job_phone': (str, none_type), # noqa: E501 - 'job_city': (str, none_type), # noqa: E501 - 'industry_of_interest': ([str], none_type), # noqa: E501 - 'asset_classes_of_interest': ([str], none_type), # noqa: E501 - 'market_coverage': ([str], none_type), # noqa: E501 - 'responsibility': ([str], none_type), # noqa: E501 - 'function': ([str], none_type), # noqa: E501 - 'instrument': ([str], none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - 'avatars': ([Avatar], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'display_name': 'displayName', # noqa: E501 - 'company_name': 'companyName', # noqa: E501 - 'email': 'email', # noqa: E501 - 'mobile': 'mobile', # noqa: E501 - 'job_title': 'jobTitle', # noqa: E501 - 'job_role': 'jobRole', # noqa: E501 - 'job_department': 'jobDepartment', # noqa: E501 - 'job_division': 'jobDivision', # noqa: E501 - 'job_phone': 'jobPhone', # noqa: E501 - 'job_city': 'jobCity', # noqa: E501 - 'industry_of_interest': 'industryOfInterest', # noqa: E501 - 'asset_classes_of_interest': 'assetClassesOfInterest', # noqa: E501 - 'market_coverage': 'marketCoverage', # noqa: E501 - 'responsibility': 'responsibility', # noqa: E501 - 'function': 'function', # noqa: E501 - 'instrument': 'instrument', # noqa: E501 - 'id': 'id', # noqa: E501 - 'avatars': 'avatars', # noqa: E501 - } - - read_only_vars = { - } + Profile + """ # noqa: E501 + display_name: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, description="The display name in Directory, it is expected to be the same as group name", alias="displayName") + company_name: Optional[StrictStr] = Field(default=None, description="The company name is expected to be the same as group company owner", alias="companyName") + email: Optional[StrictStr] = None + mobile: Optional[StrictStr] = None + job_title: Optional[StrictStr] = Field(default=None, alias="jobTitle") + job_role: Optional[StrictStr] = Field(default=None, alias="jobRole") + job_department: Optional[StrictStr] = Field(default=None, alias="jobDepartment") + job_division: Optional[StrictStr] = Field(default=None, alias="jobDivision") + job_phone: Optional[StrictStr] = Field(default=None, alias="jobPhone") + job_city: Optional[StrictStr] = Field(default=None, alias="jobCity") + industry_of_interest: Optional[List[StrictStr]] = Field(default=None, alias="industryOfInterest") + asset_classes_of_interest: Optional[List[StrictStr]] = Field(default=None, alias="assetClassesOfInterest") + market_coverage: Optional[List[StrictStr]] = Field(default=None, alias="marketCoverage") + responsibility: Optional[List[StrictStr]] = None + function: Optional[List[StrictStr]] = None + instrument: Optional[List[StrictStr]] = None + id: Optional[StrictStr] = Field(default=None, description="Profile unique identifier") + avatars: Optional[List[Avatar]] = None + __properties: ClassVar[List[str]] = ["displayName", "companyName", "email", "mobile", "jobTitle", "jobRole", "jobDepartment", "jobDivision", "jobPhone", "jobCity", "industryOfInterest", "assetClassesOfInterest", "marketCoverage", "responsibility", "function", "instrument", "id", "avatars"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Profile - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - display_name (str): The display name in Directory, it is expected to be the same as group name. [optional] # noqa: E501 - company_name (str): The company name is expected to be the same as group company owner. [optional] # noqa: E501 - email (str): [optional] # noqa: E501 - mobile (str): [optional] # noqa: E501 - job_title (str): [optional] # noqa: E501 - job_role (str): [optional] # noqa: E501 - job_department (str): [optional] # noqa: E501 - job_division (str): [optional] # noqa: E501 - job_phone (str): [optional] # noqa: E501 - job_city (str): [optional] # noqa: E501 - industry_of_interest ([str]): [optional] # noqa: E501 - asset_classes_of_interest ([str]): [optional] # noqa: E501 - market_coverage ([str]): [optional] # noqa: E501 - responsibility ([str]): [optional] # noqa: E501 - function ([str]): [optional] # noqa: E501 - instrument ([str]): [optional] # noqa: E501 - id (str): Profile unique identifier. [optional] # noqa: E501 - avatars ([Avatar]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Profile from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Profile - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - display_name (str): The display name in Directory, it is expected to be the same as group name. [optional] # noqa: E501 - company_name (str): The company name is expected to be the same as group company owner. [optional] # noqa: E501 - email (str): [optional] # noqa: E501 - mobile (str): [optional] # noqa: E501 - job_title (str): [optional] # noqa: E501 - job_role (str): [optional] # noqa: E501 - job_department (str): [optional] # noqa: E501 - job_division (str): [optional] # noqa: E501 - job_phone (str): [optional] # noqa: E501 - job_city (str): [optional] # noqa: E501 - industry_of_interest ([str]): [optional] # noqa: E501 - asset_classes_of_interest ([str]): [optional] # noqa: E501 - market_coverage ([str]): [optional] # noqa: E501 - responsibility ([str]): [optional] # noqa: E501 - function ([str]): [optional] # noqa: E501 - instrument ([str]): [optional] # noqa: E501 - id (str): Profile unique identifier. [optional] # noqa: E501 - avatars ([Avatar]): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in avatars (list) + _items = [] + if self.avatars: + for _item_avatars in self.avatars: + if _item_avatars: + _items.append(_item_avatars.to_dict()) + _dict['avatars'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Profile from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "displayName": obj.get("displayName"), + "companyName": obj.get("companyName"), + "email": obj.get("email"), + "mobile": obj.get("mobile"), + "jobTitle": obj.get("jobTitle"), + "jobRole": obj.get("jobRole"), + "jobDepartment": obj.get("jobDepartment"), + "jobDivision": obj.get("jobDivision"), + "jobPhone": obj.get("jobPhone"), + "jobCity": obj.get("jobCity"), + "industryOfInterest": obj.get("industryOfInterest"), + "assetClassesOfInterest": obj.get("assetClassesOfInterest"), + "marketCoverage": obj.get("marketCoverage"), + "responsibility": obj.get("responsibility"), + "function": obj.get("function"), + "instrument": obj.get("instrument"), + "id": obj.get("id"), + "avatars": [Avatar.from_dict(_item) for _item in obj["avatars"]] if obj.get("avatars") is not None else None + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.display_name: str = None - self.company_name: str = None - self.email: str = None - self.mobile: str = None - self.job_title: str = None - self.job_role: str = None - self.job_department: str = None - self.job_division: str = None - self.job_phone: str = None - self.job_city: str = None - self.industry_of_interest: List[str] = None - self.asset_classes_of_interest: List[str] = None - self.market_coverage: List[str] = None - self.responsibility: List[str] = None - self.function: List[str] = None - self.instrument: List[str] = None - self.id: str = None - self.avatars: List[Avatar] = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - BaseProfile, - ProfileAllOf, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/group_model/profile_all_of.py b/symphony/bdk/gen/group_model/profile_all_of.py deleted file mode 100644 index 81073c71..00000000 --- a/symphony/bdk/gen/group_model/profile_all_of.py +++ /dev/null @@ -1,264 +0,0 @@ -""" - Symphony Profile Manager - - Profile Manager is a microservice to manage users profile and groups # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.group_model.avatar import Avatar -globals()['Avatar'] = Avatar - -class ProfileAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'avatars': ([Avatar], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'avatars': 'avatars', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ProfileAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Profile unique identifier. [optional] # noqa: E501 - avatars ([Avatar]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ProfileAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Profile unique identifier. [optional] # noqa: E501 - avatars ([Avatar]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.id: str = None - self.avatars: List[Avatar] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/profile_control.py b/symphony/bdk/gen/group_model/profile_control.py index 069e08c2..ff785508 100644 --- a/symphony/bdk/gen/group_model/profile_control.py +++ b/symphony/bdk/gen/group_model/profile_control.py @@ -1,290 +1,105 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.group_model.implicit_connection import ImplicitConnection from symphony.bdk.gen.group_model.visibility_restriction import VisibilityRestriction -globals()['ImplicitConnection'] = ImplicitConnection -globals()['VisibilityRestriction'] = VisibilityRestriction - -class ProfileControl(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ProfileControl(BaseModel): """ + ProfileControl + """ # noqa: E501 + visibility_restriction: Optional[VisibilityRestriction] = Field(default=None, alias="visibilityRestriction") + implicit_connection: Optional[ImplicitConnection] = Field(default=None, alias="implicitConnection") + wall_support: Optional[StrictBool] = Field(default=None, description="Not supported yet", alias="wallSupport") + profile_fields: Optional[List[StrictStr]] = Field(default=None, alias="profileFields") + search_fields: Optional[List[StrictStr]] = Field(default=None, alias="searchFields") + can_have_public_profile: Optional[StrictBool] = Field(default=True, description="For the SDL groupe type this flag is true, for the company groupe type it is false", alias="canHavePublicProfile") + __properties: ClassVar[List[str]] = ["visibilityRestriction", "implicitConnection", "wallSupport", "profileFields", "searchFields", "canHavePublicProfile"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - ('profile_fields',): { - }, - ('search_fields',): { - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProfileControl from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'visibility_restriction': (VisibilityRestriction, none_type), # noqa: E501 - 'implicit_connection': (ImplicitConnection, none_type), # noqa: E501 - 'wall_support': (bool, none_type), # noqa: E501 - 'profile_fields': ([str], none_type), # noqa: E501 - 'search_fields': ([str], none_type), # noqa: E501 - 'can_have_public_profile': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'visibility_restriction': 'visibilityRestriction', # noqa: E501 - 'implicit_connection': 'implicitConnection', # noqa: E501 - 'wall_support': 'wallSupport', # noqa: E501 - 'profile_fields': 'profileFields', # noqa: E501 - 'search_fields': 'searchFields', # noqa: E501 - 'can_have_public_profile': 'canHavePublicProfile', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of visibility_restriction + if self.visibility_restriction: + _dict['visibilityRestriction'] = self.visibility_restriction.to_dict() + # override the default output from pydantic by calling `to_dict()` of implicit_connection + if self.implicit_connection: + _dict['implicitConnection'] = self.implicit_connection.to_dict() + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ProfileControl - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - visibility_restriction (VisibilityRestriction): [optional] # noqa: E501 - implicit_connection (ImplicitConnection): [optional] # noqa: E501 - wall_support (bool): Not supported yet. [optional] # noqa: E501 - profile_fields ([str]): [optional] # noqa: E501 - search_fields ([str]): [optional] # noqa: E501 - can_have_public_profile (bool): For the SDL groupe type this flag is true, for the company groupe type it is false. [optional] if omitted the server will use the default value of True # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ProfileControl - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - visibility_restriction (VisibilityRestriction): [optional] # noqa: E501 - implicit_connection (ImplicitConnection): [optional] # noqa: E501 - wall_support (bool): Not supported yet. [optional] # noqa: E501 - profile_fields ([str]): [optional] # noqa: E501 - search_fields ([str]): [optional] # noqa: E501 - can_have_public_profile (bool): For the SDL groupe type this flag is true, for the company groupe type it is false. [optional] if omitted the server will use the default value of True # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProfileControl from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "visibilityRestriction": VisibilityRestriction.from_dict(obj["visibilityRestriction"]) if obj.get("visibilityRestriction") is not None else None, + "implicitConnection": ImplicitConnection.from_dict(obj["implicitConnection"]) if obj.get("implicitConnection") is not None else None, + "wallSupport": obj.get("wallSupport"), + "profileFields": obj.get("profileFields"), + "searchFields": obj.get("searchFields"), + "canHavePublicProfile": obj.get("canHavePublicProfile") if obj.get("canHavePublicProfile") is not None else True + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.visibility_restriction: VisibilityRestriction = None - self.implicit_connection: ImplicitConnection = None - self.wall_support: bool = None - self.profile_fields: List[str] = None - self.search_fields: List[str] = None - self.can_have_public_profile: bool = True - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/read_group.py b/symphony/bdk/gen/group_model/read_group.py index ae227e26..e87d3e1b 100644 --- a/symphony/bdk/gen/group_model/read_group.py +++ b/symphony/bdk/gen/group_model/read_group.py @@ -1,419 +1,159 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.group_model.base_group import BaseGroup +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.group_model.group_implicit_connection import GroupImplicitConnection from symphony.bdk.gen.group_model.group_interaction_transfer import GroupInteractionTransfer from symphony.bdk.gen.group_model.group_visibility_restriction import GroupVisibilityRestriction from symphony.bdk.gen.group_model.owner import Owner from symphony.bdk.gen.group_model.profile import Profile -from symphony.bdk.gen.group_model.read_group_all_of import ReadGroupAllOf from symphony.bdk.gen.group_model.read_member import ReadMember from symphony.bdk.gen.group_model.status import Status -globals()['BaseGroup'] = BaseGroup -globals()['GroupImplicitConnection'] = GroupImplicitConnection -globals()['GroupInteractionTransfer'] = GroupInteractionTransfer -globals()['GroupVisibilityRestriction'] = GroupVisibilityRestriction -globals()['Owner'] = Owner -globals()['Profile'] = Profile -globals()['ReadGroupAllOf'] = ReadGroupAllOf -globals()['ReadMember'] = ReadMember -globals()['Status'] = Status - -class ReadGroup(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ReadGroup(BaseModel): """ - - allowed_values = { - ('sub_type',): { - 'COMMUNITY': "COMMUNITY", - 'CHANNEL': "CHANNEL", - }, - } - - validations = { - ('type',): { - 'min_length': 1, - }, - ('name',): { - 'min_length': 1, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str,), # noqa: E501 - 'owner_type': (Owner,), # noqa: E501 - 'owner_id': (int,), # noqa: E501 - 'name': (str,), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - 'created_date': (datetime, none_type), # noqa: E501 - 'created_by': (str, none_type), # noqa: E501 - 'updated_date': (datetime, none_type), # noqa: E501 - 'updated_by': (str, none_type), # noqa: E501 - 'status': (Status, none_type), # noqa: E501 - 'e_tag': (str, none_type), # noqa: E501 - 'sub_type': (str, none_type), # noqa: E501 - 'referrer': (str, none_type), # noqa: E501 - 'members': ([ReadMember], none_type), # noqa: E501 - 'profile': (Profile, none_type), # noqa: E501 - 'visibility_restriction': (GroupVisibilityRestriction, none_type), # noqa: E501 - 'implicit_connection': (GroupImplicitConnection, none_type), # noqa: E501 - 'interaction_transfer': (GroupInteractionTransfer, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'type': 'type', # noqa: E501 - 'owner_type': 'ownerType', # noqa: E501 - 'owner_id': 'ownerId', # noqa: E501 - 'name': 'name', # noqa: E501 - 'id': 'id', # noqa: E501 - 'created_date': 'createdDate', # noqa: E501 - 'created_by': 'createdBy', # noqa: E501 - 'updated_date': 'updatedDate', # noqa: E501 - 'updated_by': 'updatedBy', # noqa: E501 - 'status': 'status', # noqa: E501 - 'e_tag': 'eTag', # noqa: E501 - 'sub_type': 'subType', # noqa: E501 - 'referrer': 'referrer', # noqa: E501 - 'members': 'members', # noqa: E501 - 'profile': 'profile', # noqa: E501 - 'visibility_restriction': 'visibilityRestriction', # noqa: E501 - 'implicit_connection': 'implicitConnection', # noqa: E501 - 'interaction_transfer': 'interactionTransfer', # noqa: E501 - } - - read_only_vars = { - } + ReadGroup + """ # noqa: E501 + type: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Group type identifier") + owner_type: Owner = Field(alias="ownerType") + owner_id: StrictInt = Field(description="Owner id if the owner type is tenant (podId) or user (userId), otherwise null", alias="ownerId") + name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Group's name") + id: Optional[StrictStr] = Field(default=None, description="Group's unique identifier") + created_date: Optional[datetime] = Field(default=None, alias="createdDate") + created_by: Optional[StrictStr] = Field(default=None, alias="createdBy") + updated_date: Optional[datetime] = Field(default=None, alias="updatedDate") + updated_by: Optional[StrictStr] = Field(default=None, alias="updatedBy") + status: Optional[Status] = None + e_tag: Optional[StrictStr] = Field(default=None, alias="eTag") + sub_type: Optional[StrictStr] = Field(default=None, description="The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List", alias="subType") + referrer: Optional[StrictStr] = Field(default=None, description="The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List") + members: Optional[List[ReadMember]] = None + profile: Optional[Profile] = None + visibility_restriction: Optional[GroupVisibilityRestriction] = Field(default=None, alias="visibilityRestriction") + implicit_connection: Optional[GroupImplicitConnection] = Field(default=None, alias="implicitConnection") + interaction_transfer: Optional[GroupInteractionTransfer] = Field(default=None, alias="interactionTransfer") + __properties: ClassVar[List[str]] = ["type", "ownerType", "ownerId", "name", "id", "createdDate", "createdBy", "updatedDate", "updatedBy", "status", "eTag", "subType", "referrer", "members", "profile", "visibilityRestriction", "implicitConnection", "interactionTransfer"] + + @field_validator('sub_type') + def sub_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['COMMUNITY', 'CHANNEL']): + raise ValueError("must be one of enum values ('COMMUNITY', 'CHANNEL')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ReadGroup - a group_model defined in OpenAPI - - Keyword Args: - type (str): Group type identifier - owner_type (Owner): - owner_id (int): Owner id if the owner type is tenant (podId) or user (userId), otherwise null - name (str): Group's name - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group's unique identifier. [optional] # noqa: E501 - created_date (datetime): [optional] # noqa: E501 - created_by (str): [optional] # noqa: E501 - updated_date (datetime): [optional] # noqa: E501 - updated_by (str): [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - e_tag (str): [optional] # noqa: E501 - sub_type (str): The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - referrer (str): The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - members ([ReadMember]): [optional] # noqa: E501 - profile (Profile): [optional] # noqa: E501 - visibility_restriction (GroupVisibilityRestriction): [optional] # noqa: E501 - implicit_connection (GroupImplicitConnection): [optional] # noqa: E501 - interaction_transfer (GroupInteractionTransfer): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReadGroup from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ReadGroup - a group_model defined in OpenAPI - - Keyword Args: - type (str): Group type identifier - owner_type (Owner): - owner_id (int): Owner id if the owner type is tenant (podId) or user (userId), otherwise null - name (str): Group's name - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group's unique identifier. [optional] # noqa: E501 - created_date (datetime): [optional] # noqa: E501 - created_by (str): [optional] # noqa: E501 - updated_date (datetime): [optional] # noqa: E501 - updated_by (str): [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - e_tag (str): [optional] # noqa: E501 - sub_type (str): The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - referrer (str): The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - members ([ReadMember]): [optional] # noqa: E501 - profile (Profile): [optional] # noqa: E501 - visibility_restriction (GroupVisibilityRestriction): [optional] # noqa: E501 - implicit_connection (GroupImplicitConnection): [optional] # noqa: E501 - interaction_transfer (GroupInteractionTransfer): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in members (list) + _items = [] + if self.members: + for _item_members in self.members: + if _item_members: + _items.append(_item_members.to_dict()) + _dict['members'] = _items + # override the default output from pydantic by calling `to_dict()` of profile + if self.profile: + _dict['profile'] = self.profile.to_dict() + # override the default output from pydantic by calling `to_dict()` of visibility_restriction + if self.visibility_restriction: + _dict['visibilityRestriction'] = self.visibility_restriction.to_dict() + # override the default output from pydantic by calling `to_dict()` of implicit_connection + if self.implicit_connection: + _dict['implicitConnection'] = self.implicit_connection.to_dict() + # override the default output from pydantic by calling `to_dict()` of interaction_transfer + if self.interaction_transfer: + _dict['interactionTransfer'] = self.interaction_transfer.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReadGroup from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "ownerType": obj.get("ownerType"), + "ownerId": obj.get("ownerId"), + "name": obj.get("name"), + "id": obj.get("id"), + "createdDate": obj.get("createdDate"), + "createdBy": obj.get("createdBy"), + "updatedDate": obj.get("updatedDate"), + "updatedBy": obj.get("updatedBy"), + "status": obj.get("status"), + "eTag": obj.get("eTag"), + "subType": obj.get("subType"), + "referrer": obj.get("referrer"), + "members": [ReadMember.from_dict(_item) for _item in obj["members"]] if obj.get("members") is not None else None, + "profile": Profile.from_dict(obj["profile"]) if obj.get("profile") is not None else None, + "visibilityRestriction": GroupVisibilityRestriction.from_dict(obj["visibilityRestriction"]) if obj.get("visibilityRestriction") is not None else None, + "implicitConnection": GroupImplicitConnection.from_dict(obj["implicitConnection"]) if obj.get("implicitConnection") is not None else None, + "interactionTransfer": GroupInteractionTransfer.from_dict(obj["interactionTransfer"]) if obj.get("interactionTransfer") is not None else None + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.type: str = kwargs['type'] - self.owner_type: Owner = kwargs['owner_type'] - self.owner_id: int = kwargs['owner_id'] - self.name: str = kwargs['name'] - self.id: str = None - self.created_date: datetime = None - self.created_by: str = None - self.updated_date: datetime = None - self.updated_by: str = None - self.status: Status = None - self.e_tag: str = None - self.sub_type: str = None - self.referrer: str = None - self.members: List[ReadMember] = None - self.profile: Profile = None - self.visibility_restriction: GroupVisibilityRestriction = None - self.implicit_connection: GroupImplicitConnection = None - self.interaction_transfer: GroupInteractionTransfer = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - BaseGroup, - ReadGroupAllOf, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/group_model/read_group_all_of.py b/symphony/bdk/gen/group_model/read_group_all_of.py deleted file mode 100644 index 02e24042..00000000 --- a/symphony/bdk/gen/group_model/read_group_all_of.py +++ /dev/null @@ -1,338 +0,0 @@ -""" - Symphony Profile Manager - - Profile Manager is a microservice to manage users profile and groups # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.group_model.group_implicit_connection import GroupImplicitConnection -from symphony.bdk.gen.group_model.group_interaction_transfer import GroupInteractionTransfer -from symphony.bdk.gen.group_model.group_visibility_restriction import GroupVisibilityRestriction -from symphony.bdk.gen.group_model.profile import Profile -from symphony.bdk.gen.group_model.read_member import ReadMember -from symphony.bdk.gen.group_model.status import Status -globals()['GroupImplicitConnection'] = GroupImplicitConnection -globals()['GroupInteractionTransfer'] = GroupInteractionTransfer -globals()['GroupVisibilityRestriction'] = GroupVisibilityRestriction -globals()['Profile'] = Profile -globals()['ReadMember'] = ReadMember -globals()['Status'] = Status - -class ReadGroupAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('sub_type',): { - 'COMMUNITY': "COMMUNITY", - 'CHANNEL': "CHANNEL", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'created_date': (datetime, none_type), # noqa: E501 - 'created_by': (str, none_type), # noqa: E501 - 'updated_date': (datetime, none_type), # noqa: E501 - 'updated_by': (str, none_type), # noqa: E501 - 'status': (Status, none_type), # noqa: E501 - 'e_tag': (str, none_type), # noqa: E501 - 'sub_type': (str, none_type), # noqa: E501 - 'referrer': (str, none_type), # noqa: E501 - 'members': ([ReadMember], none_type), # noqa: E501 - 'profile': (Profile, none_type), # noqa: E501 - 'visibility_restriction': (GroupVisibilityRestriction, none_type), # noqa: E501 - 'implicit_connection': (GroupImplicitConnection, none_type), # noqa: E501 - 'interaction_transfer': (GroupInteractionTransfer, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'created_date': 'createdDate', # noqa: E501 - 'created_by': 'createdBy', # noqa: E501 - 'updated_date': 'updatedDate', # noqa: E501 - 'updated_by': 'updatedBy', # noqa: E501 - 'status': 'status', # noqa: E501 - 'e_tag': 'eTag', # noqa: E501 - 'sub_type': 'subType', # noqa: E501 - 'referrer': 'referrer', # noqa: E501 - 'members': 'members', # noqa: E501 - 'profile': 'profile', # noqa: E501 - 'visibility_restriction': 'visibilityRestriction', # noqa: E501 - 'implicit_connection': 'implicitConnection', # noqa: E501 - 'interaction_transfer': 'interactionTransfer', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ReadGroupAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group's unique identifier. [optional] # noqa: E501 - created_date (datetime): [optional] # noqa: E501 - created_by (str): [optional] # noqa: E501 - updated_date (datetime): [optional] # noqa: E501 - updated_by (str): [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - e_tag (str): [optional] # noqa: E501 - sub_type (str): The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - referrer (str): The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - members ([ReadMember]): [optional] # noqa: E501 - profile (Profile): [optional] # noqa: E501 - visibility_restriction (GroupVisibilityRestriction): [optional] # noqa: E501 - implicit_connection (GroupImplicitConnection): [optional] # noqa: E501 - interaction_transfer (GroupInteractionTransfer): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ReadGroupAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group's unique identifier. [optional] # noqa: E501 - created_date (datetime): [optional] # noqa: E501 - created_by (str): [optional] # noqa: E501 - updated_date (datetime): [optional] # noqa: E501 - updated_by (str): [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - e_tag (str): [optional] # noqa: E501 - sub_type (str): The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - referrer (str): The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - members ([ReadMember]): [optional] # noqa: E501 - profile (Profile): [optional] # noqa: E501 - visibility_restriction (GroupVisibilityRestriction): [optional] # noqa: E501 - implicit_connection (GroupImplicitConnection): [optional] # noqa: E501 - interaction_transfer (GroupInteractionTransfer): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.id: str = None - self.created_date: datetime = None - self.created_by: str = None - self.updated_date: datetime = None - self.updated_by: str = None - self.status: Status = None - self.e_tag: str = None - self.sub_type: str = None - self.referrer: str = None - self.members: List[ReadMember] = None - self.profile: Profile = None - self.visibility_restriction: GroupVisibilityRestriction = None - self.implicit_connection: GroupImplicitConnection = None - self.interaction_transfer: GroupInteractionTransfer = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/read_member.py b/symphony/bdk/gen/group_model/read_member.py index 2730fbbe..98edcfeb 100644 --- a/symphony/bdk/gen/group_model/read_member.py +++ b/symphony/bdk/gen/group_model/read_member.py @@ -1,329 +1,104 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.group_model.member import Member -from symphony.bdk.gen.group_model.read_member_all_of import ReadMemberAllOf -globals()['Member'] = Member -globals()['ReadMemberAllOf'] = ReadMemberAllOf -class ReadMember(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ReadMember(BaseModel): """ + ReadMember + """ # noqa: E501 + member_tenant: Optional[StrictInt] = Field(default=None, description="Member's tenant id", alias="memberTenant") + member_id: Optional[StrictInt] = Field(default=None, description="Member's user id", alias="memberId") + added_date: Optional[datetime] = Field(default=None, description="Date/time when the member has been added in the group in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sZ)", alias="addedDate") + status: Optional[StrictStr] = Field(default=None, description="Some group types (e.g. COMPANY) keep disabled users, flagging them as DISABLED. However, this attribute is not relevant for group types (e.g. SDL) that remove (instead of flag) disabled user from group") + __properties: ClassVar[List[str]] = ["memberTenant", "memberId", "addedDate", "status"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ENABLED', 'DISABLED']): + raise ValueError("must be one of enum values ('ENABLED', 'DISABLED')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('status',): { - 'ENABLED': "ENABLED", - 'DISABLED': "DISABLED", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReadMember from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'member_tenant': (int, none_type), # noqa: E501 - 'member_id': (int, none_type), # noqa: E501 - 'added_date': (datetime, none_type), # noqa: E501 - 'status': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'member_tenant': 'memberTenant', # noqa: E501 - 'member_id': 'memberId', # noqa: E501 - 'added_date': 'addedDate', # noqa: E501 - 'status': 'status', # noqa: E501 - } - - read_only_vars = { - } + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ReadMember - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - member_tenant (int): Member's tenant id. [optional] # noqa: E501 - member_id (int): Member's user id. [optional] # noqa: E501 - added_date (datetime): Date/time when the member has been added in the group in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sZ). [optional] # noqa: E501 - status (str): Some group types (e.g. COMPANY) keep disabled users, flagging them as DISABLED. However, this attribute is not relevant for group types (e.g. SDL) that remove (instead of flag) disabled user from group. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ReadMember - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - member_tenant (int): Member's tenant id. [optional] # noqa: E501 - member_id (int): Member's user id. [optional] # noqa: E501 - added_date (datetime): Date/time when the member has been added in the group in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sZ). [optional] # noqa: E501 - status (str): Some group types (e.g. COMPANY) keep disabled users, flagging them as DISABLED. However, this attribute is not relevant for group types (e.g. SDL) that remove (instead of flag) disabled user from group. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReadMember from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "memberTenant": obj.get("memberTenant"), + "memberId": obj.get("memberId"), + "addedDate": obj.get("addedDate"), + "status": obj.get("status") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.member_tenant: int = None - self.member_id: int = None - self.added_date: datetime = None - self.status: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - Member, - ReadMemberAllOf, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/group_model/read_member_all_of.py b/symphony/bdk/gen/group_model/read_member_all_of.py deleted file mode 100644 index 26132112..00000000 --- a/symphony/bdk/gen/group_model/read_member_all_of.py +++ /dev/null @@ -1,265 +0,0 @@ -""" - Symphony Profile Manager - - Profile Manager is a microservice to manage users profile and groups # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class ReadMemberAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('status',): { - 'ENABLED': "ENABLED", - 'DISABLED': "DISABLED", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'added_date': (datetime, none_type), # noqa: E501 - 'status': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'added_date': 'addedDate', # noqa: E501 - 'status': 'status', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ReadMemberAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - added_date (datetime): Date/time when the member has been added in the group in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sZ). [optional] # noqa: E501 - status (str): Some group types (e.g. COMPANY) keep disabled users, flagging them as DISABLED. However, this attribute is not relevant for group types (e.g. SDL) that remove (instead of flag) disabled user from group. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ReadMemberAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - added_date (datetime): Date/time when the member has been added in the group in ISO-8601 format (YYYY-MM-DDThh:mm:ss.sZ). [optional] # noqa: E501 - status (str): Some group types (e.g. COMPANY) keep disabled users, flagging them as DISABLED. However, this attribute is not relevant for group types (e.g. SDL) that remove (instead of flag) disabled user from group. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.added_date: datetime = None - self.status: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/sort_order.py b/symphony/bdk/gen/group_model/sort_order.py index 7f23887a..54cc8efb 100644 --- a/symphony/bdk/gen/group_model/sort_order.py +++ b/symphony/bdk/gen/group_model/sort_order.py @@ -1,282 +1,37 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class SortOrder(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('value',): { - 'ASC': "ASC", - 'DESC': "DESC", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': (str,), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - _composed_schemas = None +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """SortOrder - a group_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Sort query order., must be one of ["ASC", "DESC", ] # noqa: E501 - - Keyword Args: - value (str): Sort query order., must be one of ["ASC", "DESC", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) +class SortOrder(str, Enum): + """ + Sort query order + """ - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: str = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + """ + allowed enum values + """ + ASC = 'ASC' + DESC = 'DESC' @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """SortOrder - a group_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Sort query order., must be one of ["ASC", "DESC", ] # noqa: E501 - - Keyword Args: - value (str): Sort query order., must be one of ["ASC", "DESC", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Self: + """Create an instance of SortOrder from a JSON string""" + return cls(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - return self diff --git a/symphony/bdk/gen/group_model/status.py b/symphony/bdk/gen/group_model/status.py index 0d23d4b3..2ad1d749 100644 --- a/symphony/bdk/gen/group_model/status.py +++ b/symphony/bdk/gen/group_model/status.py @@ -1,282 +1,37 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Status(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('value',): { - 'ACTIVE': "ACTIVE", - 'DELETED': "DELETED", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': (str,), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - _composed_schemas = None +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """Status - a group_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Status flag to distinguish between active and deleted objects., must be one of ["ACTIVE", "DELETED", ] # noqa: E501 - - Keyword Args: - value (str): Status flag to distinguish between active and deleted objects., must be one of ["ACTIVE", "DELETED", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) +class Status(str, Enum): + """ + Status flag to distinguish between active and deleted objects + """ - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: str = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + """ + allowed enum values + """ + ACTIVE = 'ACTIVE' + DELETED = 'DELETED' @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """Status - a group_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] (str): Status flag to distinguish between active and deleted objects., must be one of ["ACTIVE", "DELETED", ] # noqa: E501 - - Keyword Args: - value (str): Status flag to distinguish between active and deleted objects., must be one of ["ACTIVE", "DELETED", ] # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Self: + """Create an instance of Status from a JSON string""" + return cls(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - return self diff --git a/symphony/bdk/gen/group_model/transfer_view.py b/symphony/bdk/gen/group_model/transfer_view.py index ed7210ea..fe867eaf 100644 --- a/symphony/bdk/gen/group_model/transfer_view.py +++ b/symphony/bdk/gen/group_model/transfer_view.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class TransferView(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'visible': (bool, none_type), # noqa: E501 - 'restrict_to_tenants': (bool, none_type), # noqa: E501 - 'restrict_to_users': (bool, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class TransferView(BaseModel): + """ + TransferView + """ # noqa: E501 + visible: Optional[StrictBool] = None + restrict_to_tenants: Optional[StrictBool] = Field(default=None, alias="restrictToTenants") + restrict_to_users: Optional[StrictBool] = Field(default=None, description="Not supported yet", alias="restrictToUsers") + __properties: ClassVar[List[str]] = ["visible", "restrictToTenants", "restrictToUsers"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'visible': 'visible', # noqa: E501 - 'restrict_to_tenants': 'restrictToTenants', # noqa: E501 - 'restrict_to_users': 'restrictToUsers', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """TransferView - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - visible (bool): [optional] # noqa: E501 - restrict_to_tenants (bool): [optional] # noqa: E501 - restrict_to_users (bool): Not supported yet. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TransferView from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """TransferView - a group_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - visible (bool): [optional] # noqa: E501 - restrict_to_tenants (bool): [optional] # noqa: E501 - restrict_to_users (bool): Not supported yet. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TransferView from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "visible": obj.get("visible"), + "restrictToTenants": obj.get("restrictToTenants"), + "restrictToUsers": obj.get("restrictToUsers") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.visible: bool = None - self.restrict_to_tenants: bool = None - self.restrict_to_users: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/type.py b/symphony/bdk/gen/group_model/type.py index a0b07d09..210353e1 100644 --- a/symphony/bdk/gen/group_model/type.py +++ b/symphony/bdk/gen/group_model/type.py @@ -1,350 +1,113 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.group_model.base_type import BaseType +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.group_model.interaction_control import InteractionControl from symphony.bdk.gen.group_model.membership_control import MembershipControl from symphony.bdk.gen.group_model.owner import Owner from symphony.bdk.gen.group_model.profile_control import ProfileControl from symphony.bdk.gen.group_model.status import Status -from symphony.bdk.gen.group_model.type_all_of import TypeAllOf -globals()['BaseType'] = BaseType -globals()['InteractionControl'] = InteractionControl -globals()['MembershipControl'] = MembershipControl -globals()['Owner'] = Owner -globals()['ProfileControl'] = ProfileControl -globals()['Status'] = Status -globals()['TypeAllOf'] = TypeAllOf - -class Type(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class Type(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'owner_type': (Owner, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'status': (Status, none_type), # noqa: E501 - 'profile_control': (ProfileControl, none_type), # noqa: E501 - 'membership_control': (MembershipControl, none_type), # noqa: E501 - 'interaction_control': (InteractionControl, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'owner_type': 'ownerType', # noqa: E501 - 'name': 'name', # noqa: E501 - 'status': 'status', # noqa: E501 - 'profile_control': 'profileControl', # noqa: E501 - 'membership_control': 'membershipControl', # noqa: E501 - 'interaction_control': 'interactionControl', # noqa: E501 - } - - read_only_vars = { - } + Type + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Type identifier") + owner_type: Optional[Owner] = Field(default=None, alias="ownerType") + name: Optional[StrictStr] = Field(default=None, description="Type's name") + status: Optional[Status] = None + profile_control: Optional[ProfileControl] = Field(default=None, alias="profileControl") + membership_control: Optional[MembershipControl] = Field(default=None, alias="membershipControl") + interaction_control: Optional[InteractionControl] = Field(default=None, alias="interactionControl") + __properties: ClassVar[List[str]] = ["id", "ownerType", "name", "status", "profileControl", "membershipControl", "interactionControl"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Type - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Type identifier. [optional] # noqa: E501 - owner_type (Owner): [optional] # noqa: E501 - name (str): Type's name. [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - profile_control (ProfileControl): [optional] # noqa: E501 - membership_control (MembershipControl): [optional] # noqa: E501 - interaction_control (InteractionControl): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Type from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Type - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Type identifier. [optional] # noqa: E501 - owner_type (Owner): [optional] # noqa: E501 - name (str): Type's name. [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - profile_control (ProfileControl): [optional] # noqa: E501 - membership_control (MembershipControl): [optional] # noqa: E501 - interaction_control (InteractionControl): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of profile_control + if self.profile_control: + _dict['profileControl'] = self.profile_control.to_dict() + # override the default output from pydantic by calling `to_dict()` of membership_control + if self.membership_control: + _dict['membershipControl'] = self.membership_control.to_dict() + # override the default output from pydantic by calling `to_dict()` of interaction_control + if self.interaction_control: + _dict['interactionControl'] = self.interaction_control.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Type from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "ownerType": obj.get("ownerType"), + "name": obj.get("name"), + "status": obj.get("status"), + "profileControl": ProfileControl.from_dict(obj["profileControl"]) if obj.get("profileControl") is not None else None, + "membershipControl": MembershipControl.from_dict(obj["membershipControl"]) if obj.get("membershipControl") is not None else None, + "interactionControl": InteractionControl.from_dict(obj["interactionControl"]) if obj.get("interactionControl") is not None else None + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.id: str = None - self.owner_type: Owner = None - self.name: str = None - self.status: Status = None - self.profile_control: ProfileControl = None - self.membership_control: MembershipControl = None - self.interaction_control: InteractionControl = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - BaseType, - TypeAllOf, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/group_model/type_all_of.py b/symphony/bdk/gen/group_model/type_all_of.py deleted file mode 100644 index a7d38444..00000000 --- a/symphony/bdk/gen/group_model/type_all_of.py +++ /dev/null @@ -1,273 +0,0 @@ -""" - Symphony Profile Manager - - Profile Manager is a microservice to manage users profile and groups # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.group_model.interaction_control import InteractionControl -from symphony.bdk.gen.group_model.membership_control import MembershipControl -from symphony.bdk.gen.group_model.profile_control import ProfileControl -globals()['InteractionControl'] = InteractionControl -globals()['MembershipControl'] = MembershipControl -globals()['ProfileControl'] = ProfileControl - -class TypeAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'profile_control': (ProfileControl, none_type), # noqa: E501 - 'membership_control': (MembershipControl, none_type), # noqa: E501 - 'interaction_control': (InteractionControl, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'profile_control': 'profileControl', # noqa: E501 - 'membership_control': 'membershipControl', # noqa: E501 - 'interaction_control': 'interactionControl', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """TypeAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - profile_control (ProfileControl): [optional] # noqa: E501 - membership_control (MembershipControl): [optional] # noqa: E501 - interaction_control (InteractionControl): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """TypeAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - profile_control (ProfileControl): [optional] # noqa: E501 - membership_control (MembershipControl): [optional] # noqa: E501 - interaction_control (InteractionControl): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.profile_control: ProfileControl = None - self.membership_control: MembershipControl = None - self.interaction_control: InteractionControl = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/type_list.py b/symphony/bdk/gen/group_model/type_list.py index 341cb783..83224206 100644 --- a/symphony/bdk/gen/group_model/type_list.py +++ b/symphony/bdk/gen/group_model/type_list.py @@ -1,266 +1,101 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.group_model.base_type import BaseType from symphony.bdk.gen.group_model.pagination import Pagination -globals()['BaseType'] = BaseType -globals()['Pagination'] = Pagination +from typing import Optional, Set +from typing_extensions import Self -class TypeList(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class TypeList(BaseModel): """ + TypeList + """ # noqa: E501 + pagination: Optional[Pagination] = None + data: Optional[List[BaseType]] = None + __properties: ClassVar[List[str]] = ["pagination", "data"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'pagination': (Pagination, none_type), # noqa: E501 - 'data': ([BaseType], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'pagination': 'pagination', # noqa: E501 - 'data': 'data', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """TypeList - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pagination (Pagination): [optional] # noqa: E501 - data ([BaseType]): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TypeList from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """TypeList - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pagination (Pagination): [optional] # noqa: E501 - data ([BaseType]): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TypeList from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None, + "data": [BaseType.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.pagination: Pagination = None - self.data: List[BaseType] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/update_group.py b/symphony/bdk/gen/group_model/update_group.py index 98bc7ab5..9597f82b 100644 --- a/symphony/bdk/gen/group_model/update_group.py +++ b/symphony/bdk/gen/group_model/update_group.py @@ -1,405 +1,150 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.group_model.base_profile import BaseProfile -from symphony.bdk.gen.group_model.create_group import CreateGroup from symphony.bdk.gen.group_model.group_implicit_connection import GroupImplicitConnection from symphony.bdk.gen.group_model.group_interaction_transfer import GroupInteractionTransfer from symphony.bdk.gen.group_model.group_visibility_restriction import GroupVisibilityRestriction from symphony.bdk.gen.group_model.member import Member from symphony.bdk.gen.group_model.owner import Owner from symphony.bdk.gen.group_model.status import Status -from symphony.bdk.gen.group_model.update_group_all_of import UpdateGroupAllOf -globals()['BaseProfile'] = BaseProfile -globals()['CreateGroup'] = CreateGroup -globals()['GroupImplicitConnection'] = GroupImplicitConnection -globals()['GroupInteractionTransfer'] = GroupInteractionTransfer -globals()['GroupVisibilityRestriction'] = GroupVisibilityRestriction -globals()['Member'] = Member -globals()['Owner'] = Owner -globals()['Status'] = Status -globals()['UpdateGroupAllOf'] = UpdateGroupAllOf - -class UpdateGroup(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UpdateGroup(BaseModel): """ - - allowed_values = { - ('sub_type',): { - 'COMMUNITY': "COMMUNITY", - 'CHANNEL': "CHANNEL", - }, - } - - validations = { - ('type',): { - 'min_length': 1, - }, - ('name',): { - 'min_length': 1, - }, - ('id',): { - 'min_length': 1, - }, - ('e_tag',): { - 'min_length': 1, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str,), # noqa: E501 - 'owner_type': (Owner,), # noqa: E501 - 'owner_id': (int,), # noqa: E501 - 'name': (str,), # noqa: E501 - 'sub_type': (str, none_type), # noqa: E501 - 'referrer': (str, none_type), # noqa: E501 - 'members': ([Member], none_type), # noqa: E501 - 'profile': (BaseProfile, none_type), # noqa: E501 - 'visibility_restriction': (GroupVisibilityRestriction, none_type), # noqa: E501 - 'implicit_connection': (GroupImplicitConnection, none_type), # noqa: E501 - 'interaction_transfer': (GroupInteractionTransfer, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - 'status': (Status, none_type), # noqa: E501 - 'e_tag': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'type': 'type', # noqa: E501 - 'owner_type': 'ownerType', # noqa: E501 - 'owner_id': 'ownerId', # noqa: E501 - 'name': 'name', # noqa: E501 - 'sub_type': 'subType', # noqa: E501 - 'referrer': 'referrer', # noqa: E501 - 'members': 'members', # noqa: E501 - 'profile': 'profile', # noqa: E501 - 'visibility_restriction': 'visibilityRestriction', # noqa: E501 - 'implicit_connection': 'implicitConnection', # noqa: E501 - 'interaction_transfer': 'interactionTransfer', # noqa: E501 - 'id': 'id', # noqa: E501 - 'status': 'status', # noqa: E501 - 'e_tag': 'eTag', # noqa: E501 - } - - read_only_vars = { - } + UpdateGroup + """ # noqa: E501 + type: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Group type identifier") + owner_type: Owner = Field(alias="ownerType") + owner_id: StrictInt = Field(description="Owner id if the owner type is tenant (podId) or user (userId), otherwise null", alias="ownerId") + name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Group's name") + sub_type: Optional[StrictStr] = Field(default=None, description="The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List", alias="subType") + referrer: Optional[StrictStr] = Field(default=None, description="The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List") + members: Optional[List[Member]] = None + profile: Optional[BaseProfile] = None + visibility_restriction: Optional[GroupVisibilityRestriction] = Field(default=None, alias="visibilityRestriction") + implicit_connection: Optional[GroupImplicitConnection] = Field(default=None, alias="implicitConnection") + interaction_transfer: Optional[GroupInteractionTransfer] = Field(default=None, alias="interactionTransfer") + id: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, description="Group's unique identifier") + status: Optional[Status] = None + e_tag: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, alias="eTag") + __properties: ClassVar[List[str]] = ["type", "ownerType", "ownerId", "name", "subType", "referrer", "members", "profile", "visibilityRestriction", "implicitConnection", "interactionTransfer", "id", "status", "eTag"] + + @field_validator('sub_type') + def sub_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['COMMUNITY', 'CHANNEL']): + raise ValueError("must be one of enum values ('COMMUNITY', 'CHANNEL')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UpdateGroup - a group_model defined in OpenAPI - - Keyword Args: - type (str): Group type identifier - owner_type (Owner): - owner_id (int): Owner id if the owner type is tenant (podId) or user (userId), otherwise null - name (str): Group's name - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - sub_type (str): The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - referrer (str): The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - members ([Member]): [optional] # noqa: E501 - profile (BaseProfile): [optional] # noqa: E501 - visibility_restriction (GroupVisibilityRestriction): [optional] # noqa: E501 - implicit_connection (GroupImplicitConnection): [optional] # noqa: E501 - interaction_transfer (GroupInteractionTransfer): [optional] # noqa: E501 - id (str): Group's unique identifier. [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - e_tag (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UpdateGroup from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UpdateGroup - a group_model defined in OpenAPI - - Keyword Args: - type (str): Group type identifier - owner_type (Owner): - owner_id (int): Owner id if the owner type is tenant (podId) or user (userId), otherwise null - name (str): Group's name - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - sub_type (str): The type of the company group, This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - referrer (str): The referring company name. This field is mandatory in case of a company group type, but not applicable for Symphony Distribution List. [optional] # noqa: E501 - members ([Member]): [optional] # noqa: E501 - profile (BaseProfile): [optional] # noqa: E501 - visibility_restriction (GroupVisibilityRestriction): [optional] # noqa: E501 - implicit_connection (GroupImplicitConnection): [optional] # noqa: E501 - interaction_transfer (GroupInteractionTransfer): [optional] # noqa: E501 - id (str): Group's unique identifier. [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - e_tag (str): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in members (list) + _items = [] + if self.members: + for _item_members in self.members: + if _item_members: + _items.append(_item_members.to_dict()) + _dict['members'] = _items + # override the default output from pydantic by calling `to_dict()` of profile + if self.profile: + _dict['profile'] = self.profile.to_dict() + # override the default output from pydantic by calling `to_dict()` of visibility_restriction + if self.visibility_restriction: + _dict['visibilityRestriction'] = self.visibility_restriction.to_dict() + # override the default output from pydantic by calling `to_dict()` of implicit_connection + if self.implicit_connection: + _dict['implicitConnection'] = self.implicit_connection.to_dict() + # override the default output from pydantic by calling `to_dict()` of interaction_transfer + if self.interaction_transfer: + _dict['interactionTransfer'] = self.interaction_transfer.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UpdateGroup from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "ownerType": obj.get("ownerType"), + "ownerId": obj.get("ownerId"), + "name": obj.get("name"), + "subType": obj.get("subType"), + "referrer": obj.get("referrer"), + "members": [Member.from_dict(_item) for _item in obj["members"]] if obj.get("members") is not None else None, + "profile": BaseProfile.from_dict(obj["profile"]) if obj.get("profile") is not None else None, + "visibilityRestriction": GroupVisibilityRestriction.from_dict(obj["visibilityRestriction"]) if obj.get("visibilityRestriction") is not None else None, + "implicitConnection": GroupImplicitConnection.from_dict(obj["implicitConnection"]) if obj.get("implicitConnection") is not None else None, + "interactionTransfer": GroupInteractionTransfer.from_dict(obj["interactionTransfer"]) if obj.get("interactionTransfer") is not None else None, + "id": obj.get("id"), + "status": obj.get("status"), + "eTag": obj.get("eTag") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.type: str = kwargs['type'] - self.owner_type: Owner = kwargs['owner_type'] - self.owner_id: int = kwargs['owner_id'] - self.name: str = kwargs['name'] - self.sub_type: str = None - self.referrer: str = None - self.members: List[Member] = None - self.profile: BaseProfile = None - self.visibility_restriction: GroupVisibilityRestriction = None - self.implicit_connection: GroupImplicitConnection = None - self.interaction_transfer: GroupInteractionTransfer = None - self.id: str = None - self.status: Status = None - self.e_tag: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - CreateGroup, - UpdateGroupAllOf, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/group_model/update_group_all_of.py b/symphony/bdk/gen/group_model/update_group_all_of.py deleted file mode 100644 index 6c7b1008..00000000 --- a/symphony/bdk/gen/group_model/update_group_all_of.py +++ /dev/null @@ -1,275 +0,0 @@ -""" - Symphony Profile Manager - - Profile Manager is a microservice to manage users profile and groups # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.group_model.status import Status -globals()['Status'] = Status - -class UpdateGroupAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - ('id',): { - 'min_length': 1, - }, - ('e_tag',): { - 'min_length': 1, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'status': (Status, none_type), # noqa: E501 - 'e_tag': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'status': 'status', # noqa: E501 - 'e_tag': 'eTag', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UpdateGroupAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group's unique identifier. [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - e_tag (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UpdateGroupAllOf - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group's unique identifier. [optional] # noqa: E501 - status (Status): [optional] # noqa: E501 - e_tag (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.id: str = None - self.status: Status = None - self.e_tag: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/upload_avatar.py b/symphony/bdk/gen/group_model/upload_avatar.py index 70092528..328609af 100644 --- a/symphony/bdk/gen/group_model/upload_avatar.py +++ b/symphony/bdk/gen/group_model/upload_avatar.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UploadAvatar(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'image': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBytes, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class UploadAvatar(BaseModel): + """ + UploadAvatar + """ # noqa: E501 + image: Optional[Union[StrictBytes, StrictStr]] = Field(default=None, description="The avatar image for the user profile picture.The image must be a base64-encoded .jpg, .png, or .gif. >- Image size limit: 2 MB") + __properties: ClassVar[List[str]] = ["image"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'image': 'image', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UploadAvatar - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - image (str): The avatar image for the user profile picture.The image must be a base64-encoded .jpg, .png, or .gif. >- Image size limit: 2 MB. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UploadAvatar from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UploadAvatar - a group_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - image (str): The avatar image for the user profile picture.The image must be a base64-encoded .jpg, .png, or .gif. >- Image size limit: 2 MB. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UploadAvatar from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "image": obj.get("image") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.image: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/group_model/visibility_restriction.py b/symphony/bdk/gen/group_model/visibility_restriction.py index aab3feba..6f28b52b 100644 --- a/symphony/bdk/gen/group_model/visibility_restriction.py +++ b/symphony/bdk/gen/group_model/visibility_restriction.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class VisibilityRestriction(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a group_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'visible': (bool, none_type), # noqa: E501 - 'restrict_to_tenants': (bool, none_type), # noqa: E501 - 'restrict_to_users': (bool, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class VisibilityRestriction(BaseModel): + """ + VisibilityRestriction + """ # noqa: E501 + visible: Optional[StrictBool] = None + restrict_to_tenants: Optional[StrictBool] = Field(default=None, description="Not supported yet", alias="restrictToTenants") + restrict_to_users: Optional[StrictBool] = Field(default=None, description="Not supported yet", alias="restrictToUsers") + __properties: ClassVar[List[str]] = ["visible", "restrictToTenants", "restrictToUsers"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'visible': 'visible', # noqa: E501 - 'restrict_to_tenants': 'restrictToTenants', # noqa: E501 - 'restrict_to_users': 'restrictToUsers', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """VisibilityRestriction - a group_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - visible (bool): [optional] # noqa: E501 - restrict_to_tenants (bool): Not supported yet. [optional] # noqa: E501 - restrict_to_users (bool): Not supported yet. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VisibilityRestriction from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """VisibilityRestriction - a group_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the group_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - visible (bool): [optional] # noqa: E501 - restrict_to_tenants (bool): Not supported yet. [optional] # noqa: E501 - restrict_to_users (bool): Not supported yet. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VisibilityRestriction from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "visible": obj.get("visible"), + "restrictToTenants": obj.get("restrictToTenants"), + "restrictToUsers": obj.get("restrictToUsers") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.visible: bool = None - self.restrict_to_tenants: bool = None - self.restrict_to_users: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/login_api/__init__.py b/symphony/bdk/gen/login_api/__init__.py deleted file mode 100644 index 74c41b15..00000000 --- a/symphony/bdk/gen/login_api/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# do not import all apis into this module because that uses a lot of memory and stack frames diff --git a/symphony/bdk/gen/login_api/authentication_api.py b/symphony/bdk/gen/login_api/authentication_api.py index ba7b3051..10e8641b 100644 --- a/symphony/bdk/gen/login_api/authentication_api.py +++ b/symphony/bdk/gen/login_api/authentication_api.py @@ -1,947 +1,1983 @@ +# coding: utf-8 + """ Login API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated from symphony.bdk.gen.login_model.authenticate_extension_app_request import AuthenticateExtensionAppRequest from symphony.bdk.gen.login_model.authenticate_request import AuthenticateRequest -from symphony.bdk.gen.login_model.error import Error from symphony.bdk.gen.login_model.extension_app_tokens import ExtensionAppTokens from symphony.bdk.gen.login_model.jwks import Jwks from symphony.bdk.gen.login_model.jwt_token import JwtToken from symphony.bdk.gen.login_model.token import Token +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class AuthenticationApi(object): + +class AuthenticationApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.idm_keys_get_endpoint = _Endpoint( - settings={ - 'response_type': (Jwks,), - 'auth': [], - 'endpoint_path': '/idm/keys', - 'operation_id': 'idm_keys_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - }, - 'attribute_map': { - }, - 'location_map': { - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.idm_tokens_post_endpoint = _Endpoint( - settings={ - 'response_type': (JwtToken,), - 'auth': [], - 'endpoint_path': '/idm/tokens', - 'operation_id': 'idm_tokens_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'scope', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'scope': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'scope': 'scope', - }, - 'location_map': { - 'session_token': 'header', - 'scope': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.pubkey_app_authenticate_post_endpoint = _Endpoint( - settings={ - 'response_type': (Token,), - 'auth': [], - 'endpoint_path': '/pubkey/app/authenticate', - 'operation_id': 'pubkey_app_authenticate_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'authenticate_request', - ], - 'required': [ - 'authenticate_request', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'authenticate_request': - (AuthenticateRequest,), - }, - 'attribute_map': { - }, - 'location_map': { - 'authenticate_request': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.pubkey_app_user_user_id_authenticate_post_endpoint = _Endpoint( - settings={ - 'response_type': (Token,), - 'auth': [], - 'endpoint_path': '/pubkey/app/user/{userId}/authenticate', - 'operation_id': 'pubkey_app_user_user_id_authenticate_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'user_id', - ], - 'required': [ - 'session_token', - 'user_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'user_id': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'user_id': 'userId', - }, - 'location_map': { - 'session_token': 'header', - 'user_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.pubkey_app_username_username_authenticate_post_endpoint = _Endpoint( - settings={ - 'response_type': (Token,), - 'auth': [], - 'endpoint_path': '/pubkey/app/username/{username}/authenticate', - 'operation_id': 'pubkey_app_username_username_authenticate_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'username', - ], - 'required': [ - 'session_token', - 'username', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'username': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'username': 'username', - }, - 'location_map': { - 'session_token': 'header', - 'username': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + + + @validate_call + async def idm_keys_get( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Jwks: + """Returns the Common Access Token (JWT) public keys as a JWKS. + + This is a public endpoint, no authentication is required. The JWKS can be used to verify JWT issued by the idm/tokens endpoint. Since SBE 20.14. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._idm_keys_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Jwks", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def idm_keys_get_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Jwks]: + """Returns the Common Access Token (JWT) public keys as a JWKS. + + This is a public endpoint, no authentication is required. The JWKS can be used to verify JWT issued by the idm/tokens endpoint. Since SBE 20.14. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._idm_keys_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Jwks", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def idm_keys_get_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Returns the Common Access Token (JWT) public keys as a JWKS. + + This is a public endpoint, no authentication is required. The JWKS can be used to verify JWT issued by the idm/tokens endpoint. Since SBE 20.14. + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._idm_keys_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Jwks", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _idm_keys_get_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.pubkey_authenticate_post_endpoint = _Endpoint( - settings={ - 'response_type': (Token,), - 'auth': [], - 'endpoint_path': '/pubkey/authenticate', - 'operation_id': 'pubkey_authenticate_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'authenticate_request', - ], - 'required': [ - 'authenticate_request', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'authenticate_request': - (AuthenticateRequest,), - }, - 'attribute_map': { - }, - 'location_map': { - 'authenticate_request': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/idm/keys', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def idm_tokens_post( + self, + session_token: Annotated[StrictStr, Field(description="User session authentication token")], + scope: Annotated[Optional[StrictStr], Field(description="Optional field used to get access with specific entitlements, use space separated list to define more that one ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> JwtToken: + """Returns a valid OAuth2 access token from a given session token to be used for authentication + + + :param session_token: User session authentication token (required) + :type session_token: str + :param scope: Optional field used to get access with specific entitlements, use space separated list to define more that one + :type scope: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._idm_tokens_post_serialize( + session_token=session_token, + scope=scope, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "JwtToken", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def idm_tokens_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="User session authentication token")], + scope: Annotated[Optional[StrictStr], Field(description="Optional field used to get access with specific entitlements, use space separated list to define more that one ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[JwtToken]: + """Returns a valid OAuth2 access token from a given session token to be used for authentication + + + :param session_token: User session authentication token (required) + :type session_token: str + :param scope: Optional field used to get access with specific entitlements, use space separated list to define more that one + :type scope: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._idm_tokens_post_serialize( + session_token=session_token, + scope=scope, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "JwtToken", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def idm_tokens_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="User session authentication token")], + scope: Annotated[Optional[StrictStr], Field(description="Optional field used to get access with specific entitlements, use space separated list to define more that one ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Returns a valid OAuth2 access token from a given session token to be used for authentication + + + :param session_token: User session authentication token (required) + :type session_token: str + :param scope: Optional field used to get access with specific entitlements, use space separated list to define more that one + :type scope: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._idm_tokens_post_serialize( + session_token=session_token, + scope=scope, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "JwtToken", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _idm_tokens_post_serialize( + self, + session_token, + scope, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if scope is not None: + + _query_params.append(('scope', scope)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' ] - }, - api_client=api_client - ) - self.v1_pubkey_app_authenticate_extension_app_post_endpoint = _Endpoint( - settings={ - 'response_type': (ExtensionAppTokens,), - 'auth': [], - 'endpoint_path': '/v1/pubkey/app/authenticate/extensionApp', - 'operation_id': 'v1_pubkey_app_authenticate_extension_app_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'authenticate_request', - ], - 'required': [ - 'authenticate_request', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'authenticate_request': - (AuthenticateExtensionAppRequest,), - }, - 'attribute_map': { - }, - 'location_map': { - 'authenticate_request': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/idm/tokens', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def pubkey_app_authenticate_post( + self, + authenticate_request: AuthenticateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Token: + """Authenticate an App with public key + + Based on an authentication request token signed by the application's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid app, malformed authentication token, app's public key not imported in the pod, invalid token signature etc.). + + :param authenticate_request: (required) + :type authenticate_request: AuthenticateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_app_authenticate_post_serialize( + authenticate_request=authenticate_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def pubkey_app_authenticate_post_with_http_info( + self, + authenticate_request: AuthenticateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Token]: + """Authenticate an App with public key + + Based on an authentication request token signed by the application's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid app, malformed authentication token, app's public key not imported in the pod, invalid token signature etc.). + + :param authenticate_request: (required) + :type authenticate_request: AuthenticateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_app_authenticate_post_serialize( + authenticate_request=authenticate_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def pubkey_app_authenticate_post_without_preload_content( + self, + authenticate_request: AuthenticateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Authenticate an App with public key + + Based on an authentication request token signed by the application's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid app, malformed authentication token, app's public key not imported in the pod, invalid token signature etc.). + + :param authenticate_request: (required) + :type authenticate_request: AuthenticateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_app_authenticate_post_serialize( + authenticate_request=authenticate_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _pubkey_app_authenticate_post_serialize( + self, + authenticate_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if authenticate_request is not None: + _body_params = authenticate_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' ] - }, - api_client=api_client + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pubkey/app/authenticate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def idm_keys_get( + + + + @validate_call + async def pubkey_app_user_user_id_authenticate_post( self, - **kwargs - ): - """Returns the Common Access Token (JWT) public keys as a JWKS. # noqa: E501 - - This is a public endpoint, no authentication is required. The JWKS can be used to verify JWT issued by the idm/tokens endpoint. Since SBE 20.14. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = login_api.idm_keys_get(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Jwks - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.idm_keys_get_endpoint.call_with_http_info(**kwargs) - - def idm_tokens_post( + session_token: Annotated[StrictStr, Field(description="App Session authentication token.")], + user_id: Annotated[StrictInt, Field(description="the user ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Token: + """Authenticate an application in a delegated context to act on behalf of a user + + + :param session_token: App Session authentication token. (required) + :type session_token: str + :param user_id: the user ID (required) + :type user_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_app_user_user_id_authenticate_post_serialize( + session_token=session_token, + user_id=user_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def pubkey_app_user_user_id_authenticate_post_with_http_info( self, - session_token, - **kwargs - ): - """Returns a valid OAuth2 access token from a given session token to be used for authentication # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = login_api.idm_tokens_post(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): User session authentication token - - Keyword Args: - scope (str): Optional field used to get access with specific entitlements, use space separated list to define more that one . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - JwtToken - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.idm_tokens_post_endpoint.call_with_http_info(**kwargs) - - def pubkey_app_authenticate_post( + session_token: Annotated[StrictStr, Field(description="App Session authentication token.")], + user_id: Annotated[StrictInt, Field(description="the user ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Token]: + """Authenticate an application in a delegated context to act on behalf of a user + + + :param session_token: App Session authentication token. (required) + :type session_token: str + :param user_id: the user ID (required) + :type user_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_app_user_user_id_authenticate_post_serialize( + session_token=session_token, + user_id=user_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def pubkey_app_user_user_id_authenticate_post_without_preload_content( self, - authenticate_request, - **kwargs - ): - """Authenticate an App with public key # noqa: E501 - - Based on an authentication request token signed by the application's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid app, malformed authentication token, app's public key not imported in the pod, invalid token signature etc.). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = login_api.pubkey_app_authenticate_post(authenticate_request, async_req=True) - >>> result = thread.get() - - Args: - authenticate_request (AuthenticateRequest): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Token - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['authenticate_request'] = \ - authenticate_request - return self.pubkey_app_authenticate_post_endpoint.call_with_http_info(**kwargs) - - def pubkey_app_user_user_id_authenticate_post( + session_token: Annotated[StrictStr, Field(description="App Session authentication token.")], + user_id: Annotated[StrictInt, Field(description="the user ID")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Authenticate an application in a delegated context to act on behalf of a user + + + :param session_token: App Session authentication token. (required) + :type session_token: str + :param user_id: the user ID (required) + :type user_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_app_user_user_id_authenticate_post_serialize( + session_token=session_token, + user_id=user_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _pubkey_app_user_user_id_authenticate_post_serialize( self, session_token, user_id, - **kwargs - ): - """Authenticate an application in a delegated context to act on behalf of a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = login_api.pubkey_app_user_user_id_authenticate_post(session_token, user_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): App Session authentication token. - user_id (int): the user ID - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Token - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['user_id'] = \ - user_id - return self.pubkey_app_user_user_id_authenticate_post_endpoint.call_with_http_info(**kwargs) - - def pubkey_app_username_username_authenticate_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user_id is not None: + _path_params['userId'] = user_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pubkey/app/user/{userId}/authenticate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def pubkey_app_username_username_authenticate_post( + self, + session_token: Annotated[StrictStr, Field(description="App Session authentication token.")], + username: Annotated[StrictStr, Field(description="the username")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Token: + """Authenticate an application in a delegated context to act on behalf of a user + + + :param session_token: App Session authentication token. (required) + :type session_token: str + :param username: the username (required) + :type username: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_app_username_username_authenticate_post_serialize( + session_token=session_token, + username=username, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def pubkey_app_username_username_authenticate_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="App Session authentication token.")], + username: Annotated[StrictStr, Field(description="the username")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Token]: + """Authenticate an application in a delegated context to act on behalf of a user + + + :param session_token: App Session authentication token. (required) + :type session_token: str + :param username: the username (required) + :type username: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_app_username_username_authenticate_post_serialize( + session_token=session_token, + username=username, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def pubkey_app_username_username_authenticate_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="App Session authentication token.")], + username: Annotated[StrictStr, Field(description="the username")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Authenticate an application in a delegated context to act on behalf of a user + + + :param session_token: App Session authentication token. (required) + :type session_token: str + :param username: the username (required) + :type username: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_app_username_username_authenticate_post_serialize( + session_token=session_token, + username=username, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _pubkey_app_username_username_authenticate_post_serialize( self, session_token, username, - **kwargs - ): - """Authenticate an application in a delegated context to act on behalf of a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = login_api.pubkey_app_username_username_authenticate_post(session_token, username, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): App Session authentication token. - username (str): the username - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Token - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['username'] = \ - username - return self.pubkey_app_username_username_authenticate_post_endpoint.call_with_http_info(**kwargs) - - def pubkey_authenticate_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if username is not None: + _path_params['username'] = username + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pubkey/app/username/{username}/authenticate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def pubkey_authenticate_post( + self, + authenticate_request: AuthenticateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Token: + """Authenticate with public key + + Based on an authentication request token signed by the caller's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid user, malformed authentication token, user's public key not imported in the pod, invalid token signature etc.). + + :param authenticate_request: (required) + :type authenticate_request: AuthenticateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_authenticate_post_serialize( + authenticate_request=authenticate_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def pubkey_authenticate_post_with_http_info( + self, + authenticate_request: AuthenticateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Token]: + """Authenticate with public key + + Based on an authentication request token signed by the caller's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid user, malformed authentication token, user's public key not imported in the pod, invalid token signature etc.). + + :param authenticate_request: (required) + :type authenticate_request: AuthenticateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_authenticate_post_serialize( + authenticate_request=authenticate_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def pubkey_authenticate_post_without_preload_content( + self, + authenticate_request: AuthenticateRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Authenticate with public key + + Based on an authentication request token signed by the caller's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid user, malformed authentication token, user's public key not imported in the pod, invalid token signature etc.). + + :param authenticate_request: (required) + :type authenticate_request: AuthenticateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._pubkey_authenticate_post_serialize( + authenticate_request=authenticate_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Token", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _pubkey_authenticate_post_serialize( self, authenticate_request, - **kwargs - ): - """Authenticate with public key # noqa: E501 - - Based on an authentication request token signed by the caller's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid user, malformed authentication token, user's public key not imported in the pod, invalid token signature etc.). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = login_api.pubkey_authenticate_post(authenticate_request, async_req=True) - >>> result = thread.get() - - Args: - authenticate_request (AuthenticateRequest): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Token - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['authenticate_request'] = \ - authenticate_request - return self.pubkey_authenticate_post_endpoint.call_with_http_info(**kwargs) - - def v1_pubkey_app_authenticate_extension_app_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if authenticate_request is not None: + _body_params = authenticate_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/pubkey/authenticate', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_pubkey_app_authenticate_extension_app_post( + self, + authenticate_request: AuthenticateExtensionAppRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ExtensionAppTokens: + """Authenticate extension app with public key + + Based on an authentication request token signed by the caller's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid user, malformed authentication token, user's public key not imported in the pod, invalid token signature etc.). + + :param authenticate_request: (required) + :type authenticate_request: AuthenticateExtensionAppRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_pubkey_app_authenticate_extension_app_post_serialize( + authenticate_request=authenticate_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExtensionAppTokens", + '400': "Error", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_pubkey_app_authenticate_extension_app_post_with_http_info( + self, + authenticate_request: AuthenticateExtensionAppRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ExtensionAppTokens]: + """Authenticate extension app with public key + + Based on an authentication request token signed by the caller's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid user, malformed authentication token, user's public key not imported in the pod, invalid token signature etc.). + + :param authenticate_request: (required) + :type authenticate_request: AuthenticateExtensionAppRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_pubkey_app_authenticate_extension_app_post_serialize( + authenticate_request=authenticate_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExtensionAppTokens", + '400': "Error", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_pubkey_app_authenticate_extension_app_post_without_preload_content( + self, + authenticate_request: AuthenticateExtensionAppRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Authenticate extension app with public key + + Based on an authentication request token signed by the caller's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid user, malformed authentication token, user's public key not imported in the pod, invalid token signature etc.). + + :param authenticate_request: (required) + :type authenticate_request: AuthenticateExtensionAppRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_pubkey_app_authenticate_extension_app_post_serialize( + authenticate_request=authenticate_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExtensionAppTokens", + '400': "Error", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_pubkey_app_authenticate_extension_app_post_serialize( self, authenticate_request, - **kwargs - ): - """Authenticate extension app with public key # noqa: E501 - - Based on an authentication request token signed by the caller's RSA private key, authenticate the API caller and return a session token. A HTTP 401 Unauthorized error is returned on errors during authentication (e.g. invalid user, malformed authentication token, user's public key not imported in the pod, invalid token signature etc.). # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = login_api.v1_pubkey_app_authenticate_extension_app_post(authenticate_request, async_req=True) - >>> result = thread.get() - - Args: - authenticate_request (AuthenticateExtensionAppRequest): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ExtensionAppTokens - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['authenticate_request'] = \ - authenticate_request - return self.v1_pubkey_app_authenticate_extension_app_post_endpoint.call_with_http_info(**kwargs) + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if authenticate_request is not None: + _body_params = authenticate_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/pubkey/app/authenticate/extensionApp', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/login_model/__init__.py b/symphony/bdk/gen/login_model/__init__.py deleted file mode 100644 index a14105e9..00000000 --- a/symphony/bdk/gen/login_model/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# do not import all models into this module because that uses a lot of memory and stack frames diff --git a/symphony/bdk/gen/login_model/authenticate_extension_app_request.py b/symphony/bdk/gen/login_model/authenticate_extension_app_request.py index 97762cbb..00ac1cde 100644 --- a/symphony/bdk/gen/login_model/authenticate_extension_app_request.py +++ b/symphony/bdk/gen/login_model/authenticate_extension_app_request.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Login API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AuthenticateExtensionAppRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'app_token': (str, none_type), # noqa: E501 - 'auth_token': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class AuthenticateExtensionAppRequest(BaseModel): + """ + Request body for extension app authentication + """ # noqa: E501 + app_token: Optional[StrictStr] = Field(default=None, description="application generated token", alias="appToken") + auth_token: Optional[StrictStr] = Field(default=None, description="a JWT containing the caller's username and an expiration date, signed by the caller's private key.", alias="authToken") + __properties: ClassVar[List[str]] = ["appToken", "authToken"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'app_token': 'appToken', # noqa: E501 - 'auth_token': 'authToken', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AuthenticateExtensionAppRequest - a login_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_token (str): application generated token. [optional] # noqa: E501 - auth_token (str): a JWT containing the caller's username and an expiration date, signed by the caller's private key.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AuthenticateExtensionAppRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AuthenticateExtensionAppRequest - a login_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_token (str): application generated token. [optional] # noqa: E501 - auth_token (str): a JWT containing the caller's username and an expiration date, signed by the caller's private key.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AuthenticateExtensionAppRequest from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "appToken": obj.get("appToken"), + "authToken": obj.get("authToken") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.app_token: str = None - self.auth_token: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/login_model/authenticate_request.py b/symphony/bdk/gen/login_model/authenticate_request.py index 50aec4e6..22e9841d 100644 --- a/symphony/bdk/gen/login_model/authenticate_request.py +++ b/symphony/bdk/gen/login_model/authenticate_request.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Login API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AuthenticateRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'token': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class AuthenticateRequest(BaseModel): + """ + Request body for pubkey authentication + """ # noqa: E501 + token: Optional[StrictStr] = Field(default=None, description="a JWT containing the caller's username or application appGroupId and an expiration date, signed by the caller's private key.") + __properties: ClassVar[List[str]] = ["token"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'token': 'token', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AuthenticateRequest - a login_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - token (str): a JWT containing the caller's username or application appGroupId and an expiration date, signed by the caller's private key.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AuthenticateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AuthenticateRequest - a login_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - token (str): a JWT containing the caller's username or application appGroupId and an expiration date, signed by the caller's private key.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AuthenticateRequest from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "token": obj.get("token") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.token: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/login_model/error.py b/symphony/bdk/gen/login_model/error.py index b690d89d..e0570627 100644 --- a/symphony/bdk/gen/login_model/error.py +++ b/symphony/bdk/gen/login_model/error.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Login API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Error(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'code': (int, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Error(BaseModel): + """ + Error + """ # noqa: E501 + code: Optional[StrictInt] = None + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["code", "message"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'code': 'code', # noqa: E501 - 'message': 'message', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Error - a login_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - code (int): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Error from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Error - a login_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - code (int): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Error from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.code: int = None - self.message: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/login_model/extension_app_tokens.py b/symphony/bdk/gen/login_model/extension_app_tokens.py index fc7a6e62..cf66f27e 100644 --- a/symphony/bdk/gen/login_model/extension_app_tokens.py +++ b/symphony/bdk/gen/login_model/extension_app_tokens.py @@ -1,271 +1,93 @@ +# coding: utf-8 + """ Login API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class ExtensionAppTokens(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ExtensionAppTokens(BaseModel): """ + ExtensionAppTokens + """ # noqa: E501 + app_id: Optional[StrictStr] = Field(default=None, description="Application ID", alias="appId") + app_token: Optional[StrictStr] = Field(default=None, description="This token generated by the application when calling authentication endpoint ", alias="appToken") + symphony_token: Optional[StrictStr] = Field(default=None, description="This token generated by Symphony and should be used by the application to verify that it's talking to Symphony. ", alias="symphonyToken") + expire_at: Optional[StrictInt] = Field(default=None, description="unix timestamp when the token expired", alias="expireAt") + __properties: ClassVar[List[str]] = ["appId", "appToken", "symphonyToken", "expireAt"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExtensionAppTokens from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'app_id': (str, none_type), # noqa: E501 - 'app_token': (str, none_type), # noqa: E501 - 'symphony_token': (str, none_type), # noqa: E501 - 'expire_at': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'app_id': 'appId', # noqa: E501 - 'app_token': 'appToken', # noqa: E501 - 'symphony_token': 'symphonyToken', # noqa: E501 - 'expire_at': 'expireAt', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ExtensionAppTokens - a login_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_id (str): Application ID. [optional] # noqa: E501 - app_token (str): This token generated by the application when calling authentication endpoint . [optional] # noqa: E501 - symphony_token (str): This token generated by Symphony and should be used by the application to verify that it's talking to Symphony. . [optional] # noqa: E501 - expire_at (int): unix timestamp when the token expired. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ExtensionAppTokens - a login_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_id (str): Application ID. [optional] # noqa: E501 - app_token (str): This token generated by the application when calling authentication endpoint . [optional] # noqa: E501 - symphony_token (str): This token generated by Symphony and should be used by the application to verify that it's talking to Symphony. . [optional] # noqa: E501 - expire_at (int): unix timestamp when the token expired. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExtensionAppTokens from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "appId": obj.get("appId"), + "appToken": obj.get("appToken"), + "symphonyToken": obj.get("symphonyToken"), + "expireAt": obj.get("expireAt") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.app_id: str = None - self.app_token: str = None - self.symphony_token: str = None - self.expire_at: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/login_model/jwks.py b/symphony/bdk/gen/login_model/jwks.py index 7b0e6499..f261810a 100644 --- a/symphony/bdk/gen/login_model/jwks.py +++ b/symphony/bdk/gen/login_model/jwks.py @@ -1,259 +1,87 @@ +# coding: utf-8 + """ Login API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.login_model.jwks_entry import JwksEntry -globals()['JwksEntry'] = JwksEntry - -class Jwks(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'keys': ([JwksEntry], none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Jwks(BaseModel): + """ + Jwks + """ # noqa: E501 + keys: Optional[List[Dict[str, StrictStr]]] = None + __properties: ClassVar[List[str]] = ["keys"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'keys': 'keys', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Jwks - a login_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - keys ([JwksEntry]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Jwks from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Jwks - a login_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - keys ([JwksEntry]): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Jwks from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "keys": obj.get("keys") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.keys: List[JwksEntry] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/login_model/jwks_entry.py b/symphony/bdk/gen/login_model/jwks_entry.py deleted file mode 100644 index 26b456da..00000000 --- a/symphony/bdk/gen/login_model/jwks_entry.py +++ /dev/null @@ -1,251 +0,0 @@ -""" - Login API - - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 - - The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class JwksEntry(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded - """ - return (str,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """JwksEntry - a login_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """JwksEntry - a login_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/login_model/jwt_token.py b/symphony/bdk/gen/login_model/jwt_token.py index ca40e63c..6ced8093 100644 --- a/symphony/bdk/gen/login_model/jwt_token.py +++ b/symphony/bdk/gen/login_model/jwt_token.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Login API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class JwtToken(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'token_type': (str, none_type), # noqa: E501 - 'expires_in': (int, none_type), # noqa: E501 - 'access_token': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class JwtToken(BaseModel): + """ + JwtToken + """ # noqa: E501 + token_type: Optional[StrictStr] = Field(default=None, description="Type of token, string \"Bearer\"") + expires_in: Optional[StrictInt] = Field(default=None, description="Duration of time the access token is granted for in seconds") + access_token: Optional[StrictStr] = Field(default=None, description="A JWT containing the caller's username or application, an expiration date and a set of entitlements related to the specified scope, signed by the caller's private key. ") + __properties: ClassVar[List[str]] = ["token_type", "expires_in", "access_token"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'token_type': 'token_type', # noqa: E501 - 'expires_in': 'expires_in', # noqa: E501 - 'access_token': 'access_token', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """JwtToken - a login_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - token_type (str): Type of token, string \"Bearer\". [optional] # noqa: E501 - expires_in (int): Duration of time the access token is granted for in seconds. [optional] # noqa: E501 - access_token (str): A JWT containing the caller's username or application, an expiration date and a set of entitlements related to the specified scope, signed by the caller's private key. . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of JwtToken from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """JwtToken - a login_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - token_type (str): Type of token, string \"Bearer\". [optional] # noqa: E501 - expires_in (int): Duration of time the access token is granted for in seconds. [optional] # noqa: E501 - access_token (str): A JWT containing the caller's username or application, an expiration date and a set of entitlements related to the specified scope, signed by the caller's private key. . [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of JwtToken from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "token_type": obj.get("token_type"), + "expires_in": obj.get("expires_in"), + "access_token": obj.get("access_token") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.token_type: str = None - self.expires_in: int = None - self.access_token: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/login_model/token.py b/symphony/bdk/gen/login_model/token.py index 714617d4..8e72395a 100644 --- a/symphony/bdk/gen/login_model/token.py +++ b/symphony/bdk/gen/login_model/token.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Login API - For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. # noqa: E501 + For bots and other on-premise processes to authenticate. Once authenticated, the bot will be able to use the methods described in serviceAPI.yaml and agentAPI.yaml. Authentication requests will expect the user to pass a token containing user identification information and signed by the user's private key There will be two implementations of this API, one on your Pod and one on the Key Manager. In order to fully authenticate, an API client will have to call both of these implementations and pass both of the session tokens returned as headers in all subsequent requests to the Symphony API. The version of the OpenAPI document: 20.14.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Token(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a login_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str, none_type), # noqa: E501 - 'token': (str, none_type), # noqa: E501 - 'authorization_token': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Token(BaseModel): + """ + Token + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="The name of the header in which the token should be presented on subsequent API calls. ") + token: Optional[StrictStr] = Field(default=None, description="Authentication token that should be passed as header in each API rest calls. This should be considered opaque data by the client. It is not intended to contain any data interpretable by the client. The format is secret and subject to change without notice. ") + authorization_token: Optional[StrictStr] = Field(default=None, description="(Beta) Short lived access token built from a user session. This field is still on Beta, please continue using the returned \"token\" instead. ", alias="authorizationToken") + __properties: ClassVar[List[str]] = ["name", "token", "authorizationToken"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'name': 'name', # noqa: E501 - 'token': 'token', # noqa: E501 - 'authorization_token': 'authorizationToken', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Token - a login_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): The name of the header in which the token should be presented on subsequent API calls. . [optional] # noqa: E501 - token (str): Authentication token that should be passed as header in each API rest calls. This should be considered opaque data by the client. It is not intended to contain any data interpretable by the client. The format is secret and subject to change without notice. . [optional] # noqa: E501 - authorization_token (str): (Beta) Short lived access token built from a user session. This field is still on Beta, please continue using the returned \"token\" instead. . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Token from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Token - a login_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the login_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): The name of the header in which the token should be presented on subsequent API calls. . [optional] # noqa: E501 - token (str): Authentication token that should be passed as header in each API rest calls. This should be considered opaque data by the client. It is not intended to contain any data interpretable by the client. The format is secret and subject to change without notice. . [optional] # noqa: E501 - authorization_token (str): (Beta) Short lived access token built from a user session. This field is still on Beta, please continue using the returned \"token\" instead. . [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Token from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "token": obj.get("token"), + "authorizationToken": obj.get("authorizationToken") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.token: str = None - self.authorization_token: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/model_utils.py b/symphony/bdk/gen/model_utils.py deleted file mode 100644 index 6ff3416c..00000000 --- a/symphony/bdk/gen/model_utils.py +++ /dev/null @@ -1,2036 +0,0 @@ -""" - Agent API - - This document refers to Symphony API calls to send and receive messages and content. They need the on-premise Agent installed to perform decryption/encryption of content. - sessionToken and keyManagerToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - A new authorizationToken has been introduced in the authenticationAPI response payload. It can be used to replace the sessionToken in any of the API calls and can be passed as \"Authorization\" header. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have sent no message to any stream even if a request to some subset of the requested streams would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. - MessageML is a markup language for messages. See reference here: https://docs.developers.symphony.com/building-bots-on-symphony/messages/overview-of-messageml - **Real Time Events**: The following events are returned when reading from a real time messages and events stream (\"datafeed\"). These events will be returned for datafeeds created with the v5 endpoints. To know more about the endpoints, refer to Create Messages/Events Stream and Read Messages/Events Stream. Unless otherwise specified, all events were added in 1.46. # noqa: E501 - - The version of the OpenAPI document: 20.14.0-SNAPSHOT - Generated by: https://openapi-generator.tech -""" - - -from datetime import date, datetime # noqa: F401 -from copy import deepcopy -import inspect -import io -import os -import pprint -import re -import tempfile - -from dateutil.parser import parse - -from symphony.bdk.gen.exceptions import ( - ApiKeyError, - ApiAttributeError, - ApiTypeError, - ApiValueError, -) - -none_type = type(None) -file_type = io.IOBase - - -def convert_js_args_to_python_args(fn): - from functools import wraps - @wraps(fn) - def wrapped_init(_self, *args, **kwargs): - """ - An attribute named `self` received from the api will conflicts with the reserved `self` - parameter of a class method. During generation, `self` attributes are mapped - to `_self` in models. Here, we name `_self` instead of `self` to avoid conflicts. - """ - spec_property_naming = kwargs.get('_spec_property_naming', False) - if spec_property_naming: - kwargs = change_keys_js_to_python(kwargs, _self if isinstance(_self, type) else _self.__class__) - return fn(_self, *args, **kwargs) - return wrapped_init - - -class cached_property(object): - # this caches the result of the function call for fn with no inputs - # use this as a decorator on function methods that you want converted - # into cached properties - result_key = '_results' - - def __init__(self, fn): - self._fn = fn - - def __get__(self, instance, cls=None): - if self.result_key in vars(self): - return vars(self)[self.result_key] - else: - result = self._fn() - setattr(self, self.result_key, result) - return result - - -PRIMITIVE_TYPES = (list, float, int, bool, datetime, date, str, file_type) - -def allows_single_value_input(cls): - """ - This function returns True if the input composed schema model or any - descendant model allows a value only input - This is true for cases where oneOf contains items like: - oneOf: - - float - - NumberWithValidation - - StringEnum - - ArrayModel - - null - TODO: lru_cache this - """ - if ( - issubclass(cls, ModelSimple) or - cls in PRIMITIVE_TYPES - ): - return True - elif issubclass(cls, ModelComposed): - if not cls._composed_schemas['oneOf']: - return False - return any(allows_single_value_input(c) for c in cls._composed_schemas['oneOf']) - return False - -def composed_model_input_classes(cls): - """ - This function returns a list of the possible models that can be accepted as - inputs. - TODO: lru_cache this - """ - if issubclass(cls, ModelSimple) or cls in PRIMITIVE_TYPES: - return [cls] - elif issubclass(cls, ModelNormal): - if cls.discriminator is None: - return [cls] - else: - return get_discriminated_classes(cls) - elif issubclass(cls, ModelComposed): - if not cls._composed_schemas['oneOf']: - return [] - if cls.discriminator is None: - input_classes = [] - for c in cls._composed_schemas['oneOf']: - input_classes.extend(composed_model_input_classes(c)) - return input_classes - else: - return get_discriminated_classes(cls) - return [] - - -class OpenApiModel(object): - """The base class for all OpenAPIModels""" - - def set_attribute(self, name, value): - # this is only used to set properties on self - - path_to_item = [] - if self._path_to_item: - path_to_item.extend(self._path_to_item) - path_to_item.append(name) - - if name in self.openapi_types: - required_types_mixed = self.openapi_types[name] - elif self.additional_properties_type is None: - raise ApiAttributeError( - "{0} has no attribute '{1}'".format( - type(self).__name__, name), - path_to_item - ) - elif self.additional_properties_type is not None: - required_types_mixed = self.additional_properties_type - - if get_simple_class(name) != str: - error_msg = type_error_message( - var_name=name, - var_value=name, - valid_classes=(str,), - key_type=True - ) - raise ApiTypeError( - error_msg, - path_to_item=path_to_item, - valid_classes=(str,), - key_type=True - ) - - if self._check_type: - value = validate_and_convert_types( - value, required_types_mixed, path_to_item, self._spec_property_naming, - self._check_type, configuration=self._configuration) - if (name,) in self.allowed_values and value is not None: - check_allowed_values( - self.allowed_values, - (name,), - value - ) - if (name,) in self.validations: - check_validations( - self.validations, - (name,), - value, - self._configuration - ) - self.__dict__['_data_store'][name] = value - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other - - def __setattr__(self, attr, value): - """set the value of an attribute using dot notation: `instance.attr = val`""" - self[attr] = value - - def __getattr__(self, attr): - """get the value of an attribute using dot notation: `instance.attr`""" - return self.__getitem__(attr) - - def __copy__(self): - cls = self.__class__ - if self.get("_spec_property_naming", False): - return cls._new_from_openapi_data(**self.__dict__) - else: - return new_cls.__new__(cls, **self.__dict__) - - def __deepcopy__(self, memo): - cls = self.__class__ - - if self.get("_spec_property_naming", False): - new_inst = cls._new_from_openapi_data() - else: - new_inst = cls.__new__(cls) - - for k, v in self.__dict__.items(): - setattr(new_inst, k, deepcopy(v, memo)) - return new_inst - - - def __new__(cls, *args, **kwargs): - # this function uses the discriminator to - # pick a new schema/class to instantiate because a discriminator - # propertyName value was passed in - - if len(args) == 1: - arg = args[0] - if arg is None and is_type_nullable(cls): - # The input data is the 'null' value and the type is nullable. - return None - - if issubclass(cls, ModelComposed) and allows_single_value_input(cls): - model_kwargs = {} - oneof_instance = get_oneof_instance(cls, model_kwargs, kwargs, model_arg=arg) - return oneof_instance - - - visited_composed_classes = kwargs.get('_visited_composed_classes', ()) - if ( - cls.discriminator is None or - cls in visited_composed_classes - ): - # Use case 1: this openapi schema (cls) does not have a discriminator - # Use case 2: we have already visited this class before and are sure that we - # want to instantiate it this time. We have visited this class deserializing - # a payload with a discriminator. During that process we traveled through - # this class but did not make an instance of it. Now we are making an - # instance of a composed class which contains cls in it, so this time make an instance of cls. - # - # Here's an example of use case 2: If Animal has a discriminator - # petType and we pass in "Dog", and the class Dog - # allOf includes Animal, we move through Animal - # once using the discriminator, and pick Dog. - # Then in the composed schema dog Dog, we will make an instance of the - # Animal class (because Dal has allOf: Animal) but this time we won't travel - # through Animal's discriminator because we passed in - # _visited_composed_classes = (Animal,) - - return super(OpenApiModel, cls).__new__(cls) - - # Get the name and value of the discriminator property. - # The discriminator name is obtained from the discriminator meta-data - # and the discriminator value is obtained from the input data. - discr_propertyname_py = list(cls.discriminator.keys())[0] - discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if discr_propertyname_js in kwargs: - discr_value = kwargs[discr_propertyname_js] - elif discr_propertyname_py in kwargs: - discr_value = kwargs[discr_propertyname_py] - else: - # The input data does not contain the discriminator property. - path_to_item = kwargs.get('_path_to_item', ()) - raise ApiValueError( - "Cannot deserialize input data due to missing discriminator. " - "The discriminator property '%s' is missing at path: %s" % - (discr_propertyname_js, path_to_item) - ) - - # Implementation note: the last argument to get_discriminator_class - # is a list of visited classes. get_discriminator_class may recursively - # call itself and update the list of visited classes, and the initial - # value must be an empty list. Hence not using 'visited_composed_classes' - new_cls = get_discriminator_class( - cls, discr_propertyname_py, discr_value, []) - if new_cls is None: - path_to_item = kwargs.get('_path_to_item', ()) - disc_prop_value = kwargs.get( - discr_propertyname_js, kwargs.get(discr_propertyname_py)) - raise ApiValueError( - "Cannot deserialize input data due to invalid discriminator " - "value. The OpenAPI document has no mapping for discriminator " - "property '%s'='%s' at path: %s" % - (discr_propertyname_js, disc_prop_value, path_to_item) - ) - - if new_cls in visited_composed_classes: - # if we are making an instance of a composed schema Descendent - # which allOf includes Ancestor, then Ancestor contains - # a discriminator that includes Descendent. - # So if we make an instance of Descendent, we have to make an - # instance of Ancestor to hold the allOf properties. - # This code detects that use case and makes the instance of Ancestor - # For example: - # When making an instance of Dog, _visited_composed_classes = (Dog,) - # then we make an instance of Animal to include in dog._composed_instances - # so when we are here, cls is Animal - # cls.discriminator != None - # cls not in _visited_composed_classes - # new_cls = Dog - # but we know we know that we already have Dog - # because it is in visited_composed_classes - # so make Animal here - return super(OpenApiModel, cls).__new__(cls) - - # Build a list containing all oneOf and anyOf descendants. - oneof_anyof_classes = None - if cls._composed_schemas is not None: - oneof_anyof_classes = ( - cls._composed_schemas.get('oneOf', ()) + - cls._composed_schemas.get('anyOf', ())) - oneof_anyof_child = new_cls in oneof_anyof_classes - kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) - - if cls._composed_schemas.get('allOf') and oneof_anyof_child: - # Validate that we can make self because when we make the - # new_cls it will not include the allOf validations in self - self_inst = super(OpenApiModel, cls).__new__(cls) - self_inst.__init__(*args, **kwargs) - - if kwargs.get("_spec_property_naming", False): - # when true, implies new is from deserialization - new_inst = new_cls._new_from_openapi_data(*args, **kwargs) - else: - new_inst = new_cls.__new__(new_cls, *args, **kwargs) - new_inst.__init__(*args, **kwargs) - - return new_inst - - - @classmethod - @convert_js_args_to_python_args - def _new_from_openapi_data(cls, *args, **kwargs): - # this function uses the discriminator to - # pick a new schema/class to instantiate because a discriminator - # propertyName value was passed in - - if len(args) == 1: - arg = args[0] - if arg is None and is_type_nullable(cls): - # The input data is the 'null' value and the type is nullable. - return None - - if issubclass(cls, ModelComposed) and allows_single_value_input(cls): - model_kwargs = {} - oneof_instance = get_oneof_instance(cls, model_kwargs, kwargs, model_arg=arg) - return oneof_instance - - - visited_composed_classes = kwargs.get('_visited_composed_classes', ()) - if ( - cls.discriminator is None or - cls in visited_composed_classes - ): - # Use case 1: this openapi schema (cls) does not have a discriminator - # Use case 2: we have already visited this class before and are sure that we - # want to instantiate it this time. We have visited this class deserializing - # a payload with a discriminator. During that process we traveled through - # this class but did not make an instance of it. Now we are making an - # instance of a composed class which contains cls in it, so this time make an instance of cls. - # - # Here's an example of use case 2: If Animal has a discriminator - # petType and we pass in "Dog", and the class Dog - # allOf includes Animal, we move through Animal - # once using the discriminator, and pick Dog. - # Then in the composed schema dog Dog, we will make an instance of the - # Animal class (because Dal has allOf: Animal) but this time we won't travel - # through Animal's discriminator because we passed in - # _visited_composed_classes = (Animal,) - - return cls._from_openapi_data(*args, **kwargs) - - # Get the name and value of the discriminator property. - # The discriminator name is obtained from the discriminator meta-data - # and the discriminator value is obtained from the input data. - discr_propertyname_py = list(cls.discriminator.keys())[0] - discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if discr_propertyname_js in kwargs: - discr_value = kwargs[discr_propertyname_js] - elif discr_propertyname_py in kwargs: - discr_value = kwargs[discr_propertyname_py] - else: - # The input data does not contain the discriminator property. - path_to_item = kwargs.get('_path_to_item', ()) - raise ApiValueError( - "Cannot deserialize input data due to missing discriminator. " - "The discriminator property '%s' is missing at path: %s" % - (discr_propertyname_js, path_to_item) - ) - - # Implementation note: the last argument to get_discriminator_class - # is a list of visited classes. get_discriminator_class may recursively - # call itself and update the list of visited classes, and the initial - # value must be an empty list. Hence not using 'visited_composed_classes' - new_cls = get_discriminator_class( - cls, discr_propertyname_py, discr_value, []) - if new_cls is None: - path_to_item = kwargs.get('_path_to_item', ()) - disc_prop_value = kwargs.get( - discr_propertyname_js, kwargs.get(discr_propertyname_py)) - raise ApiValueError( - "Cannot deserialize input data due to invalid discriminator " - "value. The OpenAPI document has no mapping for discriminator " - "property '%s'='%s' at path: %s" % - (discr_propertyname_js, disc_prop_value, path_to_item) - ) - - if new_cls in visited_composed_classes: - # if we are making an instance of a composed schema Descendent - # which allOf includes Ancestor, then Ancestor contains - # a discriminator that includes Descendent. - # So if we make an instance of Descendent, we have to make an - # instance of Ancestor to hold the allOf properties. - # This code detects that use case and makes the instance of Ancestor - # For example: - # When making an instance of Dog, _visited_composed_classes = (Dog,) - # then we make an instance of Animal to include in dog._composed_instances - # so when we are here, cls is Animal - # cls.discriminator != None - # cls not in _visited_composed_classes - # new_cls = Dog - # but we know we know that we already have Dog - # because it is in visited_composed_classes - # so make Animal here - return cls._from_openapi_data(*args, **kwargs) - - # Build a list containing all oneOf and anyOf descendants. - oneof_anyof_classes = None - if cls._composed_schemas is not None: - oneof_anyof_classes = ( - cls._composed_schemas.get('oneOf', ()) + - cls._composed_schemas.get('anyOf', ())) - oneof_anyof_child = new_cls in oneof_anyof_classes - kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) - - if cls._composed_schemas.get('allOf') and oneof_anyof_child: - # Validate that we can make self because when we make the - # new_cls it will not include the allOf validations in self - self_inst = cls._from_openapi_data(*args, **kwargs) - - - new_inst = new_cls._new_from_openapi_data(*args, **kwargs) - return new_inst - - -class ModelSimple(OpenApiModel): - """the parent class of models whose type != object in their - swagger/openapi""" - - def __setitem__(self, name, value): - """set the value of an attribute using square-bracket notation: `instance[attr] = val`""" - if name in self.required_properties: - self.__dict__[name] = value - return - - self.set_attribute(name, value) - - def get(self, name, default=None): - """returns the value of an attribute or some default value if the attribute was not set""" - if name in self.required_properties: - return self.__dict__[name] - - return self.__dict__['_data_store'].get(name, default) - - def __getitem__(self, name): - """get the value of an attribute using square-bracket notation: `instance[attr]`""" - if name in self: - return self.get(name) - - raise ApiAttributeError( - "{0} has no attribute '{1}'".format( - type(self).__name__, name), - [e for e in [self._path_to_item, name] if e] - ) - - def __contains__(self, name): - """used by `in` operator to check if an attribute value was set in an instance: `'attr' in instance`""" - if name in self.required_properties: - return name in self.__dict__ - - return name in self.__dict__['_data_store'] - - def to_str(self): - """Returns the string representation of the model""" - return str(self.value) - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, self.__class__): - return False - - this_val = self._data_store['value'] - that_val = other._data_store['value'] - types = set() - types.add(this_val.__class__) - types.add(that_val.__class__) - vals_equal = this_val == that_val - return vals_equal - - -class ModelNormal(OpenApiModel): - """the parent class of models whose type == object in their - swagger/openapi""" - - def __setitem__(self, name, value): - """set the value of an attribute using square-bracket notation: `instance[attr] = val`""" - if name in self.required_properties: - self.__dict__[name] = value - return - - self.set_attribute(name, value) - - def get(self, name, default=None): - """returns the value of an attribute or some default value if the attribute was not set""" - if name in self.required_properties: - return self.__dict__[name] - - return self.__dict__['_data_store'].get(name, default) - - def __getitem__(self, name): - """get the value of an attribute using square-bracket notation: `instance[attr]`""" - if name in self: - return self.get(name) - - raise ApiAttributeError( - "{0} has no attribute '{1}'".format( - type(self).__name__, name), - [e for e in [self._path_to_item, name] if e] - ) - - def __contains__(self, name): - """used by `in` operator to check if an attribute value was set in an instance: `'attr' in instance`""" - if name in self.required_properties: - return name in self.__dict__ - - return name in self.__dict__['_data_store'] - - def to_dict(self): - """Returns the model properties as a dict""" - return model_to_dict(self, serialize=False) - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, self.__class__): - return False - - if not set(self._data_store.keys()) == set(other._data_store.keys()): - return False - for _var_name, this_val in self._data_store.items(): - that_val = other._data_store[_var_name] - types = set() - types.add(this_val.__class__) - types.add(that_val.__class__) - vals_equal = this_val == that_val - if not vals_equal: - return False - return True - - -class ModelComposed(OpenApiModel): - """the parent class of models whose type == object in their - swagger/openapi and have oneOf/allOf/anyOf - - When one sets a property we use var_name_to_model_instances to store the value in - the correct class instances + run any type checking + validation code. - When one gets a property we use var_name_to_model_instances to get the value - from the correct class instances. - This allows multiple composed schemas to contain the same property with additive - constraints on the value. - - _composed_schemas (dict) stores the anyOf/allOf/oneOf classes - key (str): allOf/oneOf/anyOf - value (list): the classes in the XOf definition. - Note: none_type can be included when the openapi document version >= 3.1.0 - _composed_instances (list): stores a list of instances of the composed schemas - defined in _composed_schemas. When properties are accessed in the self instance, - they are returned from the self._data_store or the data stores in the instances - in self._composed_schemas - _var_name_to_model_instances (dict): maps between a variable name on self and - the composed instances (self included) which contain that data - key (str): property name - value (list): list of class instances, self or instances in _composed_instances - which contain the value that the key is referring to. - """ - - def __setitem__(self, name, value): - """set the value of an attribute using square-bracket notation: `instance[attr] = val`""" - if name in self.required_properties: - self.__dict__[name] = value - return - - """ - Use cases: - 1. additional_properties_type is None (additionalProperties == False in spec) - Check for property presence in self.openapi_types - if not present then throw an error - if present set in self, set attribute - always set on composed schemas - 2. additional_properties_type exists - set attribute on self - always set on composed schemas - """ - if self.additional_properties_type is None: - """ - For an attribute to exist on a composed schema it must: - - fulfill schema_requirements in the self composed schema not considering oneOf/anyOf/allOf schemas AND - - fulfill schema_requirements in each oneOf/anyOf/allOf schemas - - schema_requirements: - For an attribute to exist on a schema it must: - - be present in properties at the schema OR - - have additionalProperties unset (defaults additionalProperties = any type) OR - - have additionalProperties set - """ - if name not in self.openapi_types: - raise ApiAttributeError( - "{0} has no attribute '{1}'".format( - type(self).__name__, name), - [e for e in [self._path_to_item, name] if e] - ) - # attribute must be set on self and composed instances - self.set_attribute(name, value) - for model_instance in self._composed_instances: - setattr(model_instance, name, value) - if name not in self._var_name_to_model_instances: - # we assigned an additional property - self.__dict__['_var_name_to_model_instances'][name] = self._composed_instances + [self] - return None - - __unset_attribute_value__ = object() - - def get(self, name, default=None): - """returns the value of an attribute or some default value if the attribute was not set""" - if name in self.required_properties: - return self.__dict__[name] - - # get the attribute from the correct instance - model_instances = self._var_name_to_model_instances.get(name) - values = [] - # A composed model stores self and child (oneof/anyOf/allOf) models under - # self._var_name_to_model_instances. - # Any property must exist in self and all model instances - # The value stored in all model instances must be the same - if model_instances: - for model_instance in model_instances: - if name in model_instance._data_store: - v = model_instance._data_store[name] - if v not in values: - values.append(v) - len_values = len(values) - if len_values == 0: - return default - elif len_values == 1: - return values[0] - elif len_values > 1: - raise ApiValueError( - "Values stored for property {0} in {1} differ when looking " - "at self and self's composed instances. All values must be " - "the same".format(name, type(self).__name__), - [e for e in [self._path_to_item, name] if e] - ) - - def __getitem__(self, name): - """get the value of an attribute using square-bracket notation: `instance[attr]`""" - value = self.get(name, self.__unset_attribute_value__) - if value is self.__unset_attribute_value__: - raise ApiAttributeError( - "{0} has no attribute '{1}'".format( - type(self).__name__, name), - [e for e in [self._path_to_item, name] if e] - ) - return value - - def __contains__(self, name): - """used by `in` operator to check if an attribute value was set in an instance: `'attr' in instance`""" - - if name in self.required_properties: - return name in self.__dict__ - - model_instances = self._var_name_to_model_instances.get( - name, self._additional_properties_model_instances) - - if model_instances: - for model_instance in model_instances: - if name in model_instance._data_store: - return True - - return False - - def to_dict(self): - """Returns the model properties as a dict""" - return model_to_dict(self, serialize=False) - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, self.__class__): - return False - - if not set(self._data_store.keys()) == set(other._data_store.keys()): - return False - for _var_name, this_val in self._data_store.items(): - that_val = other._data_store[_var_name] - types = set() - types.add(this_val.__class__) - types.add(that_val.__class__) - vals_equal = this_val == that_val - if not vals_equal: - return False - return True - - -COERCION_INDEX_BY_TYPE = { - ModelComposed: 0, - ModelNormal: 1, - ModelSimple: 2, - none_type: 3, # The type of 'None'. - list: 4, - dict: 5, - float: 6, - int: 7, - bool: 8, - datetime: 9, - date: 10, - str: 11, - file_type: 12, # 'file_type' is an alias for the built-in 'file' or 'io.IOBase' type. -} - -# these are used to limit what type conversions we try to do -# when we have a valid type already and we want to try converting -# to another type -UPCONVERSION_TYPE_PAIRS = ( - (str, datetime), - (str, date), - (int, float), # A float may be serialized as an integer, e.g. '3' is a valid serialized float. - (list, ModelComposed), - (dict, ModelComposed), - (str, ModelComposed), - (int, ModelComposed), - (float, ModelComposed), - (list, ModelComposed), - (list, ModelNormal), - (dict, ModelNormal), - (str, ModelSimple), - (int, ModelSimple), - (float, ModelSimple), - (list, ModelSimple), -) - -COERCIBLE_TYPE_PAIRS = { - False: ( # client instantiation of a model with client data - # (dict, ModelComposed), - # (list, ModelComposed), - # (dict, ModelNormal), - # (list, ModelNormal), - # (str, ModelSimple), - # (int, ModelSimple), - # (float, ModelSimple), - # (list, ModelSimple), - # (str, int), - # (str, float), - # (str, datetime), - # (str, date), - # (int, str), - # (float, str), - ), - True: ( # server -> client data - (dict, ModelComposed), - (list, ModelComposed), - (dict, ModelNormal), - (list, ModelNormal), - (str, ModelSimple), - (int, ModelSimple), - (float, ModelSimple), - (list, ModelSimple), - # (str, int), - # (str, float), - (str, datetime), - (str, date), - # (int, str), - # (float, str), - (str, file_type) - ), -} - - -def get_simple_class(input_value): - """Returns an input_value's simple class that we will use for type checking - Python2: - float and int will return int, where int is the python3 int backport - str and unicode will return str, where str is the python3 str backport - Note: float and int ARE both instances of int backport - Note: str_py2 and unicode_py2 are NOT both instances of str backport - - Args: - input_value (class/class_instance): the item for which we will return - the simple class - """ - if isinstance(input_value, type): - # input_value is a class - return input_value - elif isinstance(input_value, tuple): - return tuple - elif isinstance(input_value, list): - return list - elif isinstance(input_value, dict): - return dict - elif isinstance(input_value, none_type): - return none_type - elif isinstance(input_value, file_type): - return file_type - elif isinstance(input_value, bool): - # this must be higher than the int check because - # isinstance(True, int) == True - return bool - elif isinstance(input_value, int): - return int - elif isinstance(input_value, datetime): - # this must be higher than the date check because - # isinstance(datetime_instance, date) == True - return datetime - elif isinstance(input_value, date): - return date - elif isinstance(input_value, str): - return str - return type(input_value) - - -def check_allowed_values(allowed_values, input_variable_path, input_values): - """Raises an exception if the input_values are not allowed - - Args: - allowed_values (dict): the allowed_values dict - input_variable_path (tuple): the path to the input variable - input_values (list/str/int/float/date/datetime): the values that we - are checking to see if they are in allowed_values - """ - these_allowed_values = list(allowed_values[input_variable_path].values()) - if (isinstance(input_values, list) - and not set(input_values).issubset( - set(these_allowed_values))): - invalid_values = ", ".join( - map(str, set(input_values) - set(these_allowed_values))), - raise ApiValueError( - "Invalid values for `%s` [%s], must be a subset of [%s]" % - ( - input_variable_path[0], - invalid_values, - ", ".join(map(str, these_allowed_values)) - ) - ) - elif (isinstance(input_values, dict) - and not set( - input_values.keys()).issubset(set(these_allowed_values))): - invalid_values = ", ".join( - map(str, set(input_values.keys()) - set(these_allowed_values))) - raise ApiValueError( - "Invalid keys in `%s` [%s], must be a subset of [%s]" % - ( - input_variable_path[0], - invalid_values, - ", ".join(map(str, these_allowed_values)) - ) - ) - elif (not isinstance(input_values, (list, dict)) - and input_values not in these_allowed_values): - raise ApiValueError( - "Invalid value for `%s` (%s), must be one of %s" % - ( - input_variable_path[0], - input_values, - these_allowed_values - ) - ) - - -def is_json_validation_enabled(schema_keyword, configuration=None): - """Returns true if JSON schema validation is enabled for the specified - validation keyword. This can be used to skip JSON schema structural validation - as requested in the configuration. - - Args: - schema_keyword (string): the name of a JSON schema validation keyword. - configuration (Configuration): the configuration class. - """ - - return (configuration is None or - not hasattr(configuration, '_disabled_client_side_validations') or - schema_keyword not in configuration._disabled_client_side_validations) - - -def check_validations( - validations, input_variable_path, input_values, - configuration=None): - """Raises an exception if the input_values are invalid - - Args: - validations (dict): the validation dictionary. - input_variable_path (tuple): the path to the input variable. - input_values (list/str/int/float/date/datetime): the values that we - are checking. - configuration (Configuration): the configuration class. - """ - - if input_values is None: - return - - current_validations = validations[input_variable_path] - if (is_json_validation_enabled('multipleOf', configuration) and - 'multiple_of' in current_validations and - isinstance(input_values, (int, float)) and - not (float(input_values) / current_validations['multiple_of']).is_integer()): - # Note 'multipleOf' will be as good as the floating point arithmetic. - raise ApiValueError( - "Invalid value for `%s`, value must be a multiple of " - "`%s`" % ( - input_variable_path[0], - current_validations['multiple_of'] - ) - ) - - if (is_json_validation_enabled('maxLength', configuration) and - 'max_length' in current_validations and - len(input_values) > current_validations['max_length']): - raise ApiValueError( - "Invalid value for `%s`, length must be less than or equal to " - "`%s`" % ( - input_variable_path[0], - current_validations['max_length'] - ) - ) - - if (is_json_validation_enabled('minLength', configuration) and - 'min_length' in current_validations and - len(input_values) < current_validations['min_length']): - raise ApiValueError( - "Invalid value for `%s`, length must be greater than or equal to " - "`%s`" % ( - input_variable_path[0], - current_validations['min_length'] - ) - ) - - if (is_json_validation_enabled('maxItems', configuration) and - 'max_items' in current_validations and - len(input_values) > current_validations['max_items']): - raise ApiValueError( - "Invalid value for `%s`, number of items must be less than or " - "equal to `%s`" % ( - input_variable_path[0], - current_validations['max_items'] - ) - ) - - if (is_json_validation_enabled('minItems', configuration) and - 'min_items' in current_validations and - len(input_values) < current_validations['min_items']): - raise ValueError( - "Invalid value for `%s`, number of items must be greater than or " - "equal to `%s`" % ( - input_variable_path[0], - current_validations['min_items'] - ) - ) - - items = ('exclusive_maximum', 'inclusive_maximum', 'exclusive_minimum', - 'inclusive_minimum') - if (any(item in current_validations for item in items)): - if isinstance(input_values, list): - max_val = max(input_values) - min_val = min(input_values) - elif isinstance(input_values, dict): - max_val = max(input_values.values()) - min_val = min(input_values.values()) - else: - max_val = input_values - min_val = input_values - - if (is_json_validation_enabled('exclusiveMaximum', configuration) and - 'exclusive_maximum' in current_validations and - max_val >= current_validations['exclusive_maximum']): - raise ApiValueError( - "Invalid value for `%s`, must be a value less than `%s`" % ( - input_variable_path[0], - current_validations['exclusive_maximum'] - ) - ) - - if (is_json_validation_enabled('maximum', configuration) and - 'inclusive_maximum' in current_validations and - max_val > current_validations['inclusive_maximum']): - raise ApiValueError( - "Invalid value for `%s`, must be a value less than or equal to " - "`%s`" % ( - input_variable_path[0], - current_validations['inclusive_maximum'] - ) - ) - - if (is_json_validation_enabled('exclusiveMinimum', configuration) and - 'exclusive_minimum' in current_validations and - min_val <= current_validations['exclusive_minimum']): - raise ApiValueError( - "Invalid value for `%s`, must be a value greater than `%s`" % - ( - input_variable_path[0], - current_validations['exclusive_maximum'] - ) - ) - - if (is_json_validation_enabled('minimum', configuration) and - 'inclusive_minimum' in current_validations and - min_val < current_validations['inclusive_minimum']): - raise ApiValueError( - "Invalid value for `%s`, must be a value greater than or equal " - "to `%s`" % ( - input_variable_path[0], - current_validations['inclusive_minimum'] - ) - ) - flags = current_validations.get('regex', {}).get('flags', 0) - if (is_json_validation_enabled('pattern', configuration) and - 'regex' in current_validations and - not re.search(current_validations['regex']['pattern'], - input_values, flags=flags)): - err_msg = r"Invalid value for `%s`, must match regular expression `%s`" % ( - input_variable_path[0], - current_validations['regex']['pattern'] - ) - if flags != 0: - # Don't print the regex flags if the flags are not - # specified in the OAS document. - err_msg = r"%s with flags=`%s`" % (err_msg, flags) - raise ApiValueError(err_msg) - - -def order_response_types(required_types): - """Returns the required types sorted in coercion order - - Args: - required_types (list/tuple): collection of classes or instance of - list or dict with class information inside it. - - Returns: - (list): coercion order sorted collection of classes or instance - of list or dict with class information inside it. - """ - - def index_getter(class_or_instance): - if isinstance(class_or_instance, list): - return COERCION_INDEX_BY_TYPE[list] - elif isinstance(class_or_instance, dict): - return COERCION_INDEX_BY_TYPE[dict] - elif (inspect.isclass(class_or_instance) - and issubclass(class_or_instance, ModelComposed)): - return COERCION_INDEX_BY_TYPE[ModelComposed] - elif (inspect.isclass(class_or_instance) - and issubclass(class_or_instance, ModelNormal)): - return COERCION_INDEX_BY_TYPE[ModelNormal] - elif (inspect.isclass(class_or_instance) - and issubclass(class_or_instance, ModelSimple)): - return COERCION_INDEX_BY_TYPE[ModelSimple] - elif class_or_instance in COERCION_INDEX_BY_TYPE: - return COERCION_INDEX_BY_TYPE[class_or_instance] - raise ApiValueError("Unsupported type: %s" % class_or_instance) - - sorted_types = sorted( - required_types, - key=lambda class_or_instance: index_getter(class_or_instance) - ) - return sorted_types - - -def remove_uncoercible(required_types_classes, current_item, spec_property_naming, - must_convert=True): - """Only keeps the type conversions that are possible - - Args: - required_types_classes (tuple): tuple of classes that are required - these should be ordered by COERCION_INDEX_BY_TYPE - spec_property_naming (bool): True if the variable names in the input - data are serialized names as specified in the OpenAPI document. - False if the variables names in the input data are python - variable names in PEP-8 snake case. - current_item (any): the current item (input data) to be converted - - Keyword Args: - must_convert (bool): if True the item to convert is of the wrong - type and we want a big list of coercibles - if False, we want a limited list of coercibles - - Returns: - (list): the remaining coercible required types, classes only - """ - current_type_simple = get_simple_class(current_item) - - results_classes = [] - for required_type_class in required_types_classes: - # convert our models to OpenApiModel - required_type_class_simplified = required_type_class - if isinstance(required_type_class_simplified, type): - if issubclass(required_type_class_simplified, ModelComposed): - required_type_class_simplified = ModelComposed - elif issubclass(required_type_class_simplified, ModelNormal): - required_type_class_simplified = ModelNormal - elif issubclass(required_type_class_simplified, ModelSimple): - required_type_class_simplified = ModelSimple - - if required_type_class_simplified == current_type_simple: - # don't consider converting to one's own class - continue - - class_pair = (current_type_simple, required_type_class_simplified) - if (must_convert and class_pair in COERCIBLE_TYPE_PAIRS[spec_property_naming]) \ - or class_pair in UPCONVERSION_TYPE_PAIRS: - results_classes.append(required_type_class) - return results_classes - -def get_discriminated_classes(cls): - """ - Returns all the classes that a discriminator converts to - TODO: lru_cache this - """ - possible_classes = [] - key = list(cls.discriminator.keys())[0] - if is_type_nullable(cls): - possible_classes.append(cls) - for discr_cls in cls.discriminator[key].values(): - if hasattr(discr_cls, 'discriminator') and discr_cls.discriminator is not None: - possible_classes.extend(get_discriminated_classes(discr_cls)) - else: - possible_classes.append(discr_cls) - return possible_classes - - -def get_possible_classes(cls, from_server_context): - # TODO: lru_cache this - possible_classes = [cls] - if from_server_context: - return possible_classes - if hasattr(cls, 'discriminator') and cls.discriminator is not None: - possible_classes = [] - possible_classes.extend(get_discriminated_classes(cls)) - elif issubclass(cls, ModelComposed): - possible_classes.extend(composed_model_input_classes(cls)) - return possible_classes - - -def get_required_type_classes(required_types_mixed, spec_property_naming): - """Converts the tuple required_types into a tuple and a dict described - below - - Args: - required_types_mixed (tuple/list): will contain either classes or - instance of list or dict - spec_property_naming (bool): if True these values came from the - server, and we use the data types in our endpoints. - If False, we are client side and we need to include - oneOf and discriminator classes inside the data types in our endpoints - - Returns: - (valid_classes, dict_valid_class_to_child_types_mixed): - valid_classes (tuple): the valid classes that the current item - should be - dict_valid_class_to_child_types_mixed (dict): - valid_class (class): this is the key - child_types_mixed (list/dict/tuple): describes the valid child - types - """ - valid_classes = [] - child_req_types_by_current_type = {} - for required_type in required_types_mixed: - if isinstance(required_type, list): - valid_classes.append(list) - child_req_types_by_current_type[list] = required_type - elif isinstance(required_type, tuple): - valid_classes.append(tuple) - child_req_types_by_current_type[tuple] = required_type - elif isinstance(required_type, dict): - valid_classes.append(dict) - child_req_types_by_current_type[dict] = required_type[str] - else: - valid_classes.extend(get_possible_classes(required_type, spec_property_naming)) - return tuple(valid_classes), child_req_types_by_current_type - - -def change_keys_js_to_python(input_dict, model_class): - """ - Converts from javascript_key keys in the input_dict to python_keys in - the output dict using the mapping in model_class. - If the input_dict contains a key which does not declared in the model_class, - the key is added to the output dict as is. The assumption is the model_class - may have undeclared properties (additionalProperties attribute in the OAS - document). - """ - - if getattr(model_class, 'attribute_map', None) is None: - return input_dict - output_dict = {} - reversed_attr_map = {value: key for key, value in - model_class.attribute_map.items()} - for javascript_key, value in input_dict.items(): - python_key = reversed_attr_map.get(javascript_key) - if python_key is None: - # if the key is unknown, it is in error or it is an - # additionalProperties variable - python_key = javascript_key - output_dict[python_key] = value - return output_dict - - -def get_type_error(var_value, path_to_item, valid_classes, key_type=False): - error_msg = type_error_message( - var_name=path_to_item[-1], - var_value=var_value, - valid_classes=valid_classes, - key_type=key_type - ) - return ApiTypeError( - error_msg, - path_to_item=path_to_item, - valid_classes=valid_classes, - key_type=key_type - ) - - -def deserialize_primitive(data, klass, path_to_item): - """Deserializes string to primitive type. - - :param data: str/int/float - :param klass: str/class the class to convert to - - :return: int, float, str, bool, date, datetime - """ - additional_message = "" - try: - if klass in {datetime, date}: - additional_message = ( - "If you need your parameter to have a fallback " - "string value, please set its type as `type: {}` in your " - "spec. That allows the value to be any type. " - ) - if klass == datetime: - if len(data) < 8: - raise ValueError("This is not a datetime") - # The string should be in iso8601 datetime format. - parsed_datetime = parse(data) - date_only = ( - parsed_datetime.hour == 0 and - parsed_datetime.minute == 0 and - parsed_datetime.second == 0 and - parsed_datetime.tzinfo is None and - 8 <= len(data) <= 10 - ) - if date_only: - raise ValueError("This is a date, not a datetime") - return parsed_datetime - elif klass == date: - if len(data) < 8: - raise ValueError("This is not a date") - return parse(data).date() - else: - converted_value = klass(data) - if isinstance(data, str) and klass == float: - if str(converted_value) != data: - # '7' -> 7.0 -> '7.0' != '7' - raise ValueError('This is not a float') - return converted_value - except (OverflowError, ValueError) as ex: - # parse can raise OverflowError - raise ApiValueError( - "{0}Failed to parse {1} as {2}".format( - additional_message, repr(data), klass.__name__ - ), - path_to_item=path_to_item - ) from ex - - -def get_discriminator_class(model_class, - discr_name, - discr_value, cls_visited): - """Returns the child class specified by the discriminator. - - Args: - model_class (OpenApiModel): the model class. - discr_name (string): the name of the discriminator property. - discr_value (any): the discriminator value. - cls_visited (list): list of model classes that have been visited. - Used to determine the discriminator class without - visiting circular references indefinitely. - - Returns: - used_model_class (class/None): the chosen child class that will be used - to deserialize the data, for example dog.Dog. - If a class is not found, None is returned. - """ - - if model_class in cls_visited: - # The class has already been visited and no suitable class was found. - return None - cls_visited.append(model_class) - used_model_class = None - if discr_name in model_class.discriminator: - class_name_to_discr_class = model_class.discriminator[discr_name] - used_model_class = class_name_to_discr_class.get(discr_value) - if used_model_class is None: - # We didn't find a discriminated class in class_name_to_discr_class. - # So look in the ancestor or descendant discriminators - # The discriminator mapping may exist in a descendant (anyOf, oneOf) - # or ancestor (allOf). - # Ancestor example: in the GrandparentAnimal -> ParentPet -> ChildCat - # hierarchy, the discriminator mappings may be defined at any level - # in the hierarchy. - # Descendant example: mammal -> whale/zebra/Pig -> BasquePig/DanishPig - # if we try to make BasquePig from mammal, we need to travel through - # the oneOf descendant discriminators to find BasquePig - descendant_classes = model_class._composed_schemas.get('oneOf', ()) + \ - model_class._composed_schemas.get('anyOf', ()) - ancestor_classes = model_class._composed_schemas.get('allOf', ()) - possible_classes = descendant_classes + ancestor_classes - for cls in possible_classes: - # Check if the schema has inherited discriminators. - if hasattr(cls, 'discriminator') and cls.discriminator is not None: - used_model_class = get_discriminator_class( - cls, discr_name, discr_value, cls_visited) - if used_model_class is not None: - return used_model_class - return used_model_class - - -def deserialize_model(model_data, model_class, path_to_item, check_type, - configuration, spec_property_naming): - """Deserializes model_data to model instance. - - Args: - model_data (int/str/float/bool/none_type/list/dict): data to instantiate the model - model_class (OpenApiModel): the model class - path_to_item (list): path to the model in the received data - check_type (bool): whether to check the data tupe for the values in - the model - configuration (Configuration): the instance to use to convert files - spec_property_naming (bool): True if the variable names in the input - data are serialized names as specified in the OpenAPI document. - False if the variables names in the input data are python - variable names in PEP-8 snake case. - - Returns: - model instance - - Raise: - ApiTypeError - ApiValueError - ApiKeyError - """ - - kw_args = dict(_check_type=check_type, - _path_to_item=path_to_item, - _configuration=configuration, - _spec_property_naming=spec_property_naming) - - if issubclass(model_class, ModelSimple): - return model_class._new_from_openapi_data(model_data, **kw_args) - elif isinstance(model_data, list): - return model_class._new_from_openapi_data(*model_data, **kw_args) - if isinstance(model_data, dict): - kw_args.update(model_data) - return model_class._new_from_openapi_data(**kw_args) - elif isinstance(model_data, PRIMITIVE_TYPES): - return model_class._new_from_openapi_data(model_data, **kw_args) - - -def deserialize_file(response_data, configuration, content_disposition=None): - """Deserializes body to file - - Saves response body into a file in a temporary folder, - using the filename from the `Content-Disposition` header if provided. - - Args: - param response_data (str): the file data to write - configuration (Configuration): the instance to use to convert files - - Keyword Args: - content_disposition (str): the value of the Content-Disposition - header - - Returns: - (file_type): the deserialized file which is open - The user is responsible for closing and reading the file - """ - fd, path = tempfile.mkstemp(dir=configuration.temp_folder_path) - os.close(fd) - os.remove(path) - - if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition).group(1) - path = os.path.join(os.path.dirname(path), filename) - - with open(path, "wb") as f: - if isinstance(response_data, str): - # change str to bytes so we can write it - response_data = response_data.encode('utf-8') - f.write(response_data) - - f = open(path, "rb") - return f - - -def attempt_convert_item(input_value, valid_classes, path_to_item, - configuration, spec_property_naming, key_type=False, - must_convert=False, check_type=True): - """ - Args: - input_value (any): the data to convert - valid_classes (any): the classes that are valid - path_to_item (list): the path to the item to convert - configuration (Configuration): the instance to use to convert files - spec_property_naming (bool): True if the variable names in the input - data are serialized names as specified in the OpenAPI document. - False if the variables names in the input data are python - variable names in PEP-8 snake case. - key_type (bool): if True we need to convert a key type (not supported) - must_convert (bool): if True we must convert - check_type (bool): if True we check the type or the returned data in - ModelComposed/ModelNormal/ModelSimple instances - - Returns: - instance (any) the fixed item - - Raises: - ApiTypeError - ApiValueError - ApiKeyError - """ - valid_classes_ordered = order_response_types(valid_classes) - valid_classes_coercible = remove_uncoercible( - valid_classes_ordered, input_value, spec_property_naming) - if not valid_classes_coercible or key_type: - # we do not handle keytype errors, json will take care - # of this for us - if configuration is None or not configuration.discard_unknown_keys: - raise get_type_error(input_value, path_to_item, valid_classes, - key_type=key_type) - for valid_class in valid_classes_coercible: - try: - if issubclass(valid_class, OpenApiModel): - return deserialize_model(input_value, valid_class, - path_to_item, check_type, - configuration, spec_property_naming) - elif valid_class == file_type: - return deserialize_file(input_value, configuration) - return deserialize_primitive(input_value, valid_class, - path_to_item) - except (ApiTypeError, ApiValueError, ApiKeyError) as conversion_exc: - if must_convert: - raise conversion_exc - # if we have conversion errors when must_convert == False - # we ignore the exception and move on to the next class - continue - # we were unable to convert, must_convert == False - return input_value - - -def is_type_nullable(input_type): - """ - Returns true if None is an allowed value for the specified input_type. - - A type is nullable if at least one of the following conditions is true: - 1. The OAS 'nullable' attribute has been specified, - 1. The type is the 'null' type, - 1. The type is a anyOf/oneOf composed schema, and a child schema is - the 'null' type. - Args: - input_type (type): the class of the input_value that we are - checking - Returns: - bool - """ - if input_type is none_type: - return True - if issubclass(input_type, OpenApiModel) and input_type._nullable: - return True - if issubclass(input_type, ModelComposed): - # If oneOf/anyOf, check if the 'null' type is one of the allowed types. - for t in input_type._composed_schemas.get('oneOf', ()): - if is_type_nullable(t): return True - for t in input_type._composed_schemas.get('anyOf', ()): - if is_type_nullable(t): return True - return False - - -def is_valid_type(input_class_simple, valid_classes): - """ - Args: - input_class_simple (class): the class of the input_value that we are - checking - valid_classes (tuple): the valid classes that the current item - should be - Returns: - bool - """ - if issubclass(input_class_simple, OpenApiModel) and \ - valid_classes == (bool, date, datetime, dict, float, int, list, str, none_type,): - return True - valid_type = input_class_simple in valid_classes - if not valid_type and ( - issubclass(input_class_simple, OpenApiModel) or - input_class_simple is none_type): - for valid_class in valid_classes: - if input_class_simple is none_type and is_type_nullable(valid_class): - # Schema is oneOf/anyOf and the 'null' type is one of the allowed types. - return True - if not (issubclass(valid_class, OpenApiModel) and valid_class.discriminator): - continue - discr_propertyname_py = list(valid_class.discriminator.keys())[0] - discriminator_classes = ( - valid_class.discriminator[discr_propertyname_py].values() - ) - valid_type = is_valid_type(input_class_simple, discriminator_classes) - if valid_type: - return True - return valid_type - - -def validate_and_convert_types(input_value, required_types_mixed, path_to_item, - spec_property_naming, _check_type, configuration=None): - """Raises a TypeError is there is a problem, otherwise returns value - - Args: - input_value (any): the data to validate/convert - required_types_mixed (list/dict/tuple): A list of - valid classes, or a list tuples of valid classes, or a dict where - the value is a tuple of value classes - path_to_item: (list) the path to the data being validated - this stores a list of keys or indices to get to the data being - validated - spec_property_naming (bool): True if the variable names in the input - data are serialized names as specified in the OpenAPI document. - False if the variables names in the input data are python - variable names in PEP-8 snake case. - _check_type: (boolean) if true, type will be checked and conversion - will be attempted. - configuration: (Configuration): the configuration class to use - when converting file_type items. - If passed, conversion will be attempted when possible - If not passed, no conversions will be attempted and - exceptions will be raised - - Returns: - the correctly typed value - - Raises: - ApiTypeError - """ - results = get_required_type_classes(required_types_mixed, spec_property_naming) - valid_classes, child_req_types_by_current_type = results - - input_class_simple = get_simple_class(input_value) - valid_type = is_valid_type(input_class_simple, valid_classes) - if not valid_type: - if configuration: - # if input_value is not valid_type try to convert it - converted_instance = attempt_convert_item( - input_value, - valid_classes, - path_to_item, - configuration, - spec_property_naming, - key_type=False, - must_convert=True, - check_type=_check_type - ) - return converted_instance - else: - raise get_type_error(input_value, path_to_item, valid_classes, - key_type=False) - - # input_value's type is in valid_classes - if len(valid_classes) > 1 and configuration: - # there are valid classes which are not the current class - valid_classes_coercible = remove_uncoercible( - valid_classes, input_value, spec_property_naming, must_convert=False) - if valid_classes_coercible: - converted_instance = attempt_convert_item( - input_value, - valid_classes_coercible, - path_to_item, - configuration, - spec_property_naming, - key_type=False, - must_convert=False, - check_type=_check_type - ) - return converted_instance - - if child_req_types_by_current_type == {}: - # all types are of the required types and there are no more inner - # variables left to look at - return input_value - inner_required_types = child_req_types_by_current_type.get( - type(input_value) - ) - if inner_required_types is None: - # for this type, there are not more inner variables left to look at - return input_value - if isinstance(input_value, list): - if input_value == []: - # allow an empty list - return input_value - for index, inner_value in enumerate(input_value): - inner_path = list(path_to_item) - inner_path.append(index) - input_value[index] = validate_and_convert_types( - inner_value, - inner_required_types, - inner_path, - spec_property_naming, - _check_type, - configuration=configuration - ) - elif isinstance(input_value, dict): - if input_value == {}: - # allow an empty dict - return input_value - for inner_key, inner_val in input_value.items(): - inner_path = list(path_to_item) - inner_path.append(inner_key) - if get_simple_class(inner_key) != str: - raise get_type_error(inner_key, inner_path, valid_classes, - key_type=True) - input_value[inner_key] = validate_and_convert_types( - inner_val, - inner_required_types, - inner_path, - spec_property_naming, - _check_type, - configuration=configuration - ) - return input_value - - -def model_to_dict(model_instance, serialize=True): - """Returns the model properties as a dict - - Args: - model_instance (one of your model instances): the model instance that - will be converted to a dict. - - Keyword Args: - serialize (bool): if True, the keys in the dict will be values from - attribute_map - """ - result = {} - extract_item = lambda item: (item[0], model_to_dict(item[1], serialize=serialize)) if hasattr(item[1], '_data_store') else item - - model_instances = [model_instance] - if model_instance._composed_schemas: - model_instances.extend(model_instance._composed_instances) - seen_json_attribute_names = set() - used_fallback_python_attribute_names = set() - py_to_json_map = {} - for model_instance in model_instances: - for attr, value in model_instance._data_store.items(): - if serialize: - # we use get here because additional property key names do not - # exist in attribute_map - try: - attr = model_instance.attribute_map[attr] - py_to_json_map.update(model_instance.attribute_map) - seen_json_attribute_names.add(attr) - except KeyError: - used_fallback_python_attribute_names.add(attr) - if isinstance(value, list): - if not value: - # empty list or None - result[attr] = value - else: - res = [] - for v in value: - if isinstance(v, PRIMITIVE_TYPES) or v is None: - res.append(v) - elif isinstance(v, ModelSimple): - res.append(v.value) - elif isinstance(v, dict): - res.append(dict(map( - extract_item, - v.items() - ))) - else: - res.append(model_to_dict(v, serialize=serialize)) - result[attr] = res - elif isinstance(value, dict): - result[attr] = dict(map( - extract_item, - value.items() - )) - elif isinstance(value, ModelSimple): - result[attr] = value.value - elif hasattr(value, '_data_store'): - result[attr] = model_to_dict(value, serialize=serialize) - else: - result[attr] = value - if serialize: - for python_key in used_fallback_python_attribute_names: - json_key = py_to_json_map.get(python_key) - if json_key is None: - continue - if python_key == json_key: - continue - json_key_assigned_no_need_for_python_key = json_key in seen_json_attribute_names - if json_key_assigned_no_need_for_python_key: - del result[python_key] - - return result - - -def type_error_message(var_value=None, var_name=None, valid_classes=None, - key_type=None): - """ - Keyword Args: - var_value (any): the variable which has the type_error - var_name (str): the name of the variable which has the typ error - valid_classes (tuple): the accepted classes for current_item's - value - key_type (bool): False if our value is a value in a dict - True if it is a key in a dict - False if our item is an item in a list - """ - key_or_value = 'value' - if key_type: - key_or_value = 'key' - valid_classes_phrase = get_valid_classes_phrase(valid_classes) - msg = ( - "Invalid type for variable '{0}'. Required {1} type {2} and " - "passed type was {3}".format( - var_name, - key_or_value, - valid_classes_phrase, - type(var_value).__name__, - ) - ) - return msg - - -def get_valid_classes_phrase(input_classes): - """Returns a string phrase describing what types are allowed - """ - all_classes = list(input_classes) - all_classes = sorted(all_classes, key=lambda cls: cls.__name__) - all_class_names = [cls.__name__ for cls in all_classes] - if len(all_class_names) == 1: - return 'is {0}'.format(all_class_names[0]) - return "is one of [{0}]".format(", ".join(all_class_names)) - - -def get_allof_instances(self, model_args, constant_args): - """ - Args: - self: the class we are handling - model_args (dict): var_name to var_value - used to make instances - constant_args (dict): - metadata arguments: - _check_type - _path_to_item - _spec_property_naming - _configuration - _visited_composed_classes - - Returns - composed_instances (list) - """ - composed_instances = [] - for allof_class in self._composed_schemas['allOf']: - - try: - if constant_args.get('_spec_property_naming'): - allof_instance = allof_class._from_openapi_data(**model_args, **constant_args) - else: - allof_instance = allof_class(**model_args, **constant_args) - composed_instances.append(allof_instance) - except Exception as ex: - raise ApiValueError( - "Invalid inputs given to generate an instance of '%s'. The " - "input data was invalid for the allOf schema '%s' in the composed " - "schema '%s'. Error=%s" % ( - allof_class.__name__, - allof_class.__name__, - self.__class__.__name__, - str(ex) - ) - ) from ex - return composed_instances - - -def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None): - """ - Find the oneOf schema that matches the input data (e.g. payload). - If exactly one schema matches the input data, an instance of that schema - is returned. - If zero or more than one schema match the input data, an exception is raised. - In OAS 3.x, the payload MUST, by validation, match exactly one of the - schemas described by oneOf. - - Args: - cls: the class we are handling - model_kwargs (dict): var_name to var_value - The input data, e.g. the payload that must match a oneOf schema - in the OpenAPI document. - constant_kwargs (dict): var_name to var_value - args that every model requires, including configuration, server - and path to item. - - Kwargs: - model_arg: (int, float, bool, str, date, datetime, ModelSimple, None): - the value to assign to a primitive class or ModelSimple class - Notes: - - this is only passed in when oneOf includes types which are not object - - None is used to suppress handling of model_arg, nullable models are handled in __new__ - - Returns - oneof_instance (instance) - """ - if len(cls._composed_schemas['oneOf']) == 0: - return None - - oneof_instances = [] - # Iterate over each oneOf schema and determine if the input data - # matches the oneOf schemas. - for oneof_class in cls._composed_schemas['oneOf']: - # The composed oneOf schema allows the 'null' type and the input data - # is the null value. This is a OAS >= 3.1 feature. - if oneof_class is none_type: - # skip none_types because we are deserializing dict data. - # none_type deserialization is handled in the __new__ method - continue - - single_value_input = allows_single_value_input(oneof_class) - - try: - if not single_value_input: - if constant_kwargs.get('_spec_property_naming'): - oneof_instance = oneof_class._from_openapi_data(**model_kwargs, **constant_kwargs) - else: - oneof_instance = oneof_class(**model_kwargs, **constant_kwargs) - else: - if issubclass(oneof_class, ModelSimple): - if constant_kwargs.get('_spec_property_naming'): - oneof_instance = oneof_class._from_openapi_data(model_arg, **constant_kwargs) - else: - oneof_instance = oneof_class(model_arg, **constant_kwargs) - elif oneof_class in PRIMITIVE_TYPES: - oneof_instance = validate_and_convert_types( - model_arg, - (oneof_class,), - constant_kwargs['_path_to_item'], - constant_kwargs['_spec_property_naming'], - constant_kwargs['_check_type'], - configuration=constant_kwargs['_configuration'] - ) - oneof_instances.append(oneof_instance) - except Exception: - pass - if len(oneof_instances) == 0: - raise ApiValueError( - "Invalid inputs given to generate an instance of %s. None " - "of the oneOf schemas matched the input data." % - cls.__name__ - ) - elif len(oneof_instances) > 1: - raise ApiValueError( - "Invalid inputs given to generate an instance of %s. Multiple " - "oneOf schemas matched the inputs, but a max of one is allowed." % - cls.__name__ - ) - return oneof_instances[0] - - -def get_anyof_instances(self, model_args, constant_args): - """ - Args: - self: the class we are handling - model_args (dict): var_name to var_value - The input data, e.g. the payload that must match at least one - anyOf child schema in the OpenAPI document. - constant_args (dict): var_name to var_value - args that every model requires, including configuration, server - and path to item. - - Returns - anyof_instances (list) - """ - anyof_instances = [] - if len(self._composed_schemas['anyOf']) == 0: - return anyof_instances - - for anyof_class in self._composed_schemas['anyOf']: - # The composed oneOf schema allows the 'null' type and the input data - # is the null value. This is a OAS >= 3.1 feature. - if anyof_class is none_type: - # skip none_types because we are deserializing dict data. - # none_type deserialization is handled in the __new__ method - continue - - try: - if constant_args.get('_spec_property_naming'): - anyof_instance = anyof_class._from_openapi_data(**model_args, **constant_args) - else: - anyof_instance = anyof_class(**model_args, **constant_args) - anyof_instances.append(anyof_instance) - except Exception: - pass - if len(anyof_instances) == 0: - raise ApiValueError( - "Invalid inputs given to generate an instance of %s. None of the " - "anyOf schemas matched the inputs." % - self.__class__.__name__ - ) - return anyof_instances - - -def get_discarded_args(self, composed_instances, model_args): - """ - Gathers the args that were discarded by configuration.discard_unknown_keys - """ - model_arg_keys = model_args.keys() - discarded_args = set() - # arguments passed to self were already converted to python names - # before __init__ was called - for instance in composed_instances: - if instance.__class__ in self._composed_schemas['allOf']: - try: - keys = instance.to_dict().keys() - discarded_keys = model_args - keys - discarded_args.update(discarded_keys) - except Exception: - # allOf integer schema will throw exception - pass - else: - try: - all_keys = set(model_to_dict(instance, serialize=False).keys()) - js_keys = model_to_dict(instance, serialize=True).keys() - all_keys.update(js_keys) - discarded_keys = model_arg_keys - all_keys - discarded_args.update(discarded_keys) - except Exception: - # allOf integer schema will throw exception - pass - return discarded_args - - -def validate_get_composed_info(constant_args, model_args, self): - """ - For composed schemas, generate schema instances for - all schemas in the oneOf/anyOf/allOf definition. If additional - properties are allowed, also assign those properties on - all matched schemas that contain additionalProperties. - Openapi schemas are python classes. - - Exceptions are raised if: - - 0 or > 1 oneOf schema matches the model_args input data - - no anyOf schema matches the model_args input data - - any of the allOf schemas do not match the model_args input data - - Args: - constant_args (dict): these are the args that every model requires - model_args (dict): these are the required and optional spec args that - were passed in to make this model - self (class): the class that we are instantiating - This class contains self._composed_schemas - - Returns: - composed_info (list): length three - composed_instances (list): the composed instances which are not - self - var_name_to_model_instances (dict): a dict going from var_name - to the model_instance which holds that var_name - the model_instance may be self or an instance of one of the - classes in self.composed_instances() - additional_properties_model_instances (list): a list of the - model instances which have the property - additional_properties_type. This list can include self - """ - # create composed_instances - composed_instances = [] - allof_instances = get_allof_instances(self, model_args, constant_args) - composed_instances.extend(allof_instances) - oneof_instance = get_oneof_instance(self.__class__, model_args, constant_args) - if oneof_instance is not None: - composed_instances.append(oneof_instance) - anyof_instances = get_anyof_instances(self, model_args, constant_args) - composed_instances.extend(anyof_instances) - """ - set additional_properties_model_instances - additional properties must be evaluated at the schema level - so self's additional properties are most important - If self is a composed schema with: - - no properties defined in self - - additionalProperties: False - Then for object payloads every property is an additional property - and they are not allowed, so only empty dict is allowed - - Properties must be set on all matching schemas - so when a property is assigned toa composed instance, it must be set on all - composed instances regardless of additionalProperties presence - keeping it to prevent breaking changes in v5.0.1 - TODO remove cls._additional_properties_model_instances in 6.0.0 - """ - additional_properties_model_instances = [] - if self.additional_properties_type is not None: - additional_properties_model_instances = [self] - - """ - no need to set properties on self in here, they will be set in __init__ - By here all composed schema oneOf/anyOf/allOf instances have their properties set using - model_args - """ - discarded_args = get_discarded_args(self, composed_instances, model_args) - - # map variable names to composed_instances - var_name_to_model_instances = {} - for prop_name in model_args: - if prop_name not in discarded_args: - var_name_to_model_instances[prop_name] = [self] + composed_instances - - return [ - composed_instances, - var_name_to_model_instances, - additional_properties_model_instances, - discarded_args - ] diff --git a/symphony/bdk/gen/models/__init__.py b/symphony/bdk/gen/models/__init__.py new file mode 100644 index 00000000..61d75234 --- /dev/null +++ b/symphony/bdk/gen/models/__init__.py @@ -0,0 +1,318 @@ +# coding: utf-8 + +# This file is auto-generated by a script. Do not edit manually. + +from symphony.bdk.gen.agent_model.ack_id import AckId +from symphony.bdk.gen.agent_model.agent_info import AgentInfo +from symphony.bdk.gen.agent_model.attachment_info import AttachmentInfo +from symphony.bdk.gen.agent_model.base_message import BaseMessage +from symphony.bdk.gen.agent_model.base_signal import BaseSignal +from symphony.bdk.gen.agent_model.channel_subscriber import ChannelSubscriber +from symphony.bdk.gen.agent_model.channel_subscriber_response import ChannelSubscriberResponse +from symphony.bdk.gen.agent_model.channel_subscription_error import ChannelSubscriptionError +from symphony.bdk.gen.agent_model.channel_subscription_response import ChannelSubscriptionResponse +from symphony.bdk.gen.agent_model.connection_request_message import ConnectionRequestMessage +from symphony.bdk.gen.agent_model.datafeed import Datafeed +from symphony.bdk.gen.agent_model.error import Error +from symphony.bdk.gen.agent_model.import_response import ImportResponse +from symphony.bdk.gen.agent_model.imported_message import ImportedMessage +from symphony.bdk.gen.agent_model.ingestion_error import IngestionError +from symphony.bdk.gen.agent_model.message import Message +from symphony.bdk.gen.agent_model.message_search_query import MessageSearchQuery +from symphony.bdk.gen.agent_model.message_submission import MessageSubmission +from symphony.bdk.gen.agent_model.pagination import Pagination +from symphony.bdk.gen.agent_model.pagination_cursors import PaginationCursors +from symphony.bdk.gen.agent_model.room_created_message import RoomCreatedMessage +from symphony.bdk.gen.agent_model.room_deactivated_message import RoomDeactivatedMessage +from symphony.bdk.gen.agent_model.room_member_demoted_from_owner_message import RoomMemberDemotedFromOwnerMessage +from symphony.bdk.gen.agent_model.room_member_promoted_to_owner_message import RoomMemberPromotedToOwnerMessage +from symphony.bdk.gen.agent_model.room_reactivated_message import RoomReactivatedMessage +from symphony.bdk.gen.agent_model.room_tag import RoomTag +from symphony.bdk.gen.agent_model.room_updated_message import RoomUpdatedMessage +from symphony.bdk.gen.agent_model.share_article import ShareArticle +from symphony.bdk.gen.agent_model.share_content import ShareContent +from symphony.bdk.gen.agent_model.signal import Signal +from symphony.bdk.gen.agent_model.simple_message import SimpleMessage +from symphony.bdk.gen.agent_model.success_response import SuccessResponse +from symphony.bdk.gen.agent_model.user_joined_room_message import UserJoinedRoomMessage +from symphony.bdk.gen.agent_model.user_left_room_message import UserLeftRoomMessage +from symphony.bdk.gen.agent_model.v1_audit_trail_initiator_list import V1AuditTrailInitiatorList +from symphony.bdk.gen.agent_model.v1_audit_trail_initiator_response import V1AuditTrailInitiatorResponse +from symphony.bdk.gen.agent_model.v1_dlp_content_type import V1DLPContentType +from symphony.bdk.gen.agent_model.v1_dlp_dictionary import V1DLPDictionary +from symphony.bdk.gen.agent_model.v1_dlp_dictionary_content import V1DLPDictionaryContent +from symphony.bdk.gen.agent_model.v1_dlp_dictionary_metadata import V1DLPDictionaryMetadata +from symphony.bdk.gen.agent_model.v1_dlp_dictionary_metadata_collection_response import V1DLPDictionaryMetadataCollectionResponse +from symphony.bdk.gen.agent_model.v1_dlp_dictionary_metadata_create_request import V1DLPDictionaryMetadataCreateRequest +from symphony.bdk.gen.agent_model.v1_dlp_dictionary_metadata_response import V1DLPDictionaryMetadataResponse +from symphony.bdk.gen.agent_model.v1_dlp_dictionary_metadata_update_request import V1DLPDictionaryMetadataUpdateRequest +from symphony.bdk.gen.agent_model.v1_dlp_dictionary_ref import V1DLPDictionaryRef +from symphony.bdk.gen.agent_model.v1_dlp_matched_policy import V1DLPMatchedPolicy +from symphony.bdk.gen.agent_model.v1_dlp_outcome import V1DLPOutcome +from symphony.bdk.gen.agent_model.v1_dlp_policies_collection_response import V1DLPPoliciesCollectionResponse +from symphony.bdk.gen.agent_model.v1_dlp_policy import V1DLPPolicy +from symphony.bdk.gen.agent_model.v1_dlp_policy_request import V1DLPPolicyRequest +from symphony.bdk.gen.agent_model.v1_dlp_policy_response import V1DLPPolicyResponse +from symphony.bdk.gen.agent_model.v1_dlp_signal import V1DLPSignal +from symphony.bdk.gen.agent_model.v1_dlp_stream import V1DLPStream +from symphony.bdk.gen.agent_model.v1_dlp_violation import V1DLPViolation +from symphony.bdk.gen.agent_model.v1_dlp_violation_message import V1DLPViolationMessage +from symphony.bdk.gen.agent_model.v1_dlp_violation_message_response import V1DLPViolationMessageResponse +from symphony.bdk.gen.agent_model.v1_dlp_violation_signal import V1DLPViolationSignal +from symphony.bdk.gen.agent_model.v1_dlp_violation_signal_response import V1DLPViolationSignalResponse +from symphony.bdk.gen.agent_model.v1_dlp_violation_stream import V1DLPViolationStream +from symphony.bdk.gen.agent_model.v1_dlp_violation_stream_response import V1DLPViolationStreamResponse +from symphony.bdk.gen.agent_model.v1_health_check_response import V1HealthCheckResponse +from symphony.bdk.gen.agent_model.v2_base_message import V2BaseMessage +from symphony.bdk.gen.agent_model.v2_error import V2Error +from symphony.bdk.gen.agent_model.v2_health_check_response import V2HealthCheckResponse +from symphony.bdk.gen.agent_model.v2_import_response import V2ImportResponse +from symphony.bdk.gen.agent_model.v2_imported_message import V2ImportedMessage +from symphony.bdk.gen.agent_model.v2_message import V2Message +from symphony.bdk.gen.agent_model.v2_message_submission import V2MessageSubmission +from symphony.bdk.gen.agent_model.v3_dlp_dictionary_meta import V3DLPDictionaryMeta +from symphony.bdk.gen.agent_model.v3_dlp_file_classifier_config import V3DLPFileClassifierConfig +from symphony.bdk.gen.agent_model.v3_dlp_file_extension_config import V3DLPFileExtensionConfig +from symphony.bdk.gen.agent_model.v3_dlp_file_password_config import V3DLPFilePasswordConfig +from symphony.bdk.gen.agent_model.v3_dlp_file_size_config import V3DLPFileSizeConfig +from symphony.bdk.gen.agent_model.v3_dlp_policies_collection_response import V3DLPPoliciesCollectionResponse +from symphony.bdk.gen.agent_model.v3_dlp_policy import V3DLPPolicy +from symphony.bdk.gen.agent_model.v3_dlp_policy_applies_to import V3DLPPolicyAppliesTo +from symphony.bdk.gen.agent_model.v3_dlp_policy_request import V3DLPPolicyRequest +from symphony.bdk.gen.agent_model.v3_dlp_policy_response import V3DLPPolicyResponse +from symphony.bdk.gen.agent_model.v3_dlp_rule import V3DLPRule +from symphony.bdk.gen.agent_model.v3_dlp_text_match_config import V3DLPTextMatchConfig +from symphony.bdk.gen.agent_model.v3_dlp_violation import V3DLPViolation +from symphony.bdk.gen.agent_model.v3_dlp_violation_message import V3DLPViolationMessage +from symphony.bdk.gen.agent_model.v3_dlp_violation_message_response import V3DLPViolationMessageResponse +from symphony.bdk.gen.agent_model.v3_dlp_violation_signal import V3DLPViolationSignal +from symphony.bdk.gen.agent_model.v3_dlp_violation_signal_response import V3DLPViolationSignalResponse +from symphony.bdk.gen.agent_model.v3_dlp_violation_stream import V3DLPViolationStream +from symphony.bdk.gen.agent_model.v3_dlp_violation_stream_response import V3DLPViolationStreamResponse +from symphony.bdk.gen.agent_model.v3_health import V3Health +from symphony.bdk.gen.agent_model.v3_health_auth_type import V3HealthAuthType +from symphony.bdk.gen.agent_model.v3_health_component import V3HealthComponent +from symphony.bdk.gen.agent_model.v3_health_status import V3HealthStatus +from symphony.bdk.gen.agent_model.v4_attachment_info import V4AttachmentInfo +from symphony.bdk.gen.agent_model.v4_connection_accepted import V4ConnectionAccepted +from symphony.bdk.gen.agent_model.v4_connection_requested import V4ConnectionRequested +from symphony.bdk.gen.agent_model.v4_event import V4Event +from symphony.bdk.gen.agent_model.v4_generic_system_event import V4GenericSystemEvent +from symphony.bdk.gen.agent_model.v4_import_response import V4ImportResponse +from symphony.bdk.gen.agent_model.v4_imported_message import V4ImportedMessage +from symphony.bdk.gen.agent_model.v4_imported_message_attachment import V4ImportedMessageAttachment +from symphony.bdk.gen.agent_model.v4_initiator import V4Initiator +from symphony.bdk.gen.agent_model.v4_instant_message_created import V4InstantMessageCreated +from symphony.bdk.gen.agent_model.v4_key_value_pair import V4KeyValuePair +from symphony.bdk.gen.agent_model.v4_message import V4Message +from symphony.bdk.gen.agent_model.v4_message_blast_response import V4MessageBlastResponse +from symphony.bdk.gen.agent_model.v4_message_sent import V4MessageSent +from symphony.bdk.gen.agent_model.v4_message_suppressed import V4MessageSuppressed +from symphony.bdk.gen.agent_model.v4_payload import V4Payload +from symphony.bdk.gen.agent_model.v4_room_created import V4RoomCreated +from symphony.bdk.gen.agent_model.v4_room_deactivated import V4RoomDeactivated +from symphony.bdk.gen.agent_model.v4_room_member_demoted_from_owner import V4RoomMemberDemotedFromOwner +from symphony.bdk.gen.agent_model.v4_room_member_promoted_to_owner import V4RoomMemberPromotedToOwner +from symphony.bdk.gen.agent_model.v4_room_properties import V4RoomProperties +from symphony.bdk.gen.agent_model.v4_room_reactivated import V4RoomReactivated +from symphony.bdk.gen.agent_model.v4_room_updated import V4RoomUpdated +from symphony.bdk.gen.agent_model.v4_shared_post import V4SharedPost +from symphony.bdk.gen.agent_model.v4_stream import V4Stream +from symphony.bdk.gen.agent_model.v4_symphony_elements_action import V4SymphonyElementsAction +from symphony.bdk.gen.agent_model.v4_thumbnail_info import V4ThumbnailInfo +from symphony.bdk.gen.agent_model.v4_user import V4User +from symphony.bdk.gen.agent_model.v4_user_joined_room import V4UserJoinedRoom +from symphony.bdk.gen.agent_model.v4_user_left_room import V4UserLeftRoom +from symphony.bdk.gen.agent_model.v4_user_requested_to_join_room import V4UserRequestedToJoinRoom +from symphony.bdk.gen.agent_model.v5_datafeed import V5Datafeed +from symphony.bdk.gen.agent_model.v5_datafeed_create_body import V5DatafeedCreateBody +from symphony.bdk.gen.agent_model.v5_event_list import V5EventList +from symphony.bdk.gen.agent_model.v5_events_read_body import V5EventsReadBody +from symphony.bdk.gen.auth_model.error import Error +from symphony.bdk.gen.auth_model.extension_app_authenticate_request import ExtensionAppAuthenticateRequest +from symphony.bdk.gen.auth_model.extension_app_tokens import ExtensionAppTokens +from symphony.bdk.gen.auth_model.obo_auth_response import OboAuthResponse +from symphony.bdk.gen.auth_model.pod_certificate import PodCertificate +from symphony.bdk.gen.auth_model.success_response import SuccessResponse +from symphony.bdk.gen.auth_model.token import Token +from symphony.bdk.gen.login_model.authenticate_extension_app_request import AuthenticateExtensionAppRequest +from symphony.bdk.gen.login_model.authenticate_request import AuthenticateRequest +from symphony.bdk.gen.login_model.error import Error +from symphony.bdk.gen.login_model.extension_app_tokens import ExtensionAppTokens +from symphony.bdk.gen.login_model.jwks import Jwks +from symphony.bdk.gen.login_model.jwt_token import JwtToken +from symphony.bdk.gen.login_model.token import Token +from symphony.bdk.gen.pod_model.admin_justified_action import AdminJustifiedAction +from symphony.bdk.gen.pod_model.admin_justified_user_action import AdminJustifiedUserAction +from symphony.bdk.gen.pod_model.app_authentication_key import AppAuthenticationKey +from symphony.bdk.gen.pod_model.app_authentication_keys import AppAuthenticationKeys +from symphony.bdk.gen.pod_model.app_notification import AppNotification +from symphony.bdk.gen.pod_model.app_property import AppProperty +from symphony.bdk.gen.pod_model.application_detail import ApplicationDetail +from symphony.bdk.gen.pod_model.application_info import ApplicationInfo +from symphony.bdk.gen.pod_model.assignee_candidate import AssigneeCandidate +from symphony.bdk.gen.pod_model.assignee_candidates import AssigneeCandidates +from symphony.bdk.gen.pod_model.attachment_preview import AttachmentPreview +from symphony.bdk.gen.pod_model.avatar import Avatar +from symphony.bdk.gen.pod_model.avatar_update import AvatarUpdate +from symphony.bdk.gen.pod_model.bulk_action_result import BulkActionResult +from symphony.bdk.gen.pod_model.cert_info_item import CertInfoItem +from symphony.bdk.gen.pod_model.company_cert import CompanyCert +from symphony.bdk.gen.pod_model.company_cert_attributes import CompanyCertAttributes +from symphony.bdk.gen.pod_model.company_cert_detail import CompanyCertDetail +from symphony.bdk.gen.pod_model.company_cert_info import CompanyCertInfo +from symphony.bdk.gen.pod_model.company_cert_info_list_inner import CompanyCertInfoListInner +from symphony.bdk.gen.pod_model.company_cert_status import CompanyCertStatus +from symphony.bdk.gen.pod_model.company_cert_type import CompanyCertType +from symphony.bdk.gen.pod_model.conversation_specific_stream_attributes import ConversationSpecificStreamAttributes +from symphony.bdk.gen.pod_model.delegate_action import DelegateAction +from symphony.bdk.gen.pod_model.disclaimer import Disclaimer +from symphony.bdk.gen.pod_model.download_receipt_count import DownloadReceiptCount +from symphony.bdk.gen.pod_model.error import Error +from symphony.bdk.gen.pod_model.faceted_match_count import FacetedMatchCount +from symphony.bdk.gen.pod_model.feature import Feature +from symphony.bdk.gen.pod_model.file_extension import FileExtension +from symphony.bdk.gen.pod_model.file_extensions_response import FileExtensionsResponse +from symphony.bdk.gen.pod_model.followers_list import FollowersList +from symphony.bdk.gen.pod_model.followers_list_response import FollowersListResponse +from symphony.bdk.gen.pod_model.following_list_response import FollowingListResponse +from symphony.bdk.gen.pod_model.group import Group +from symphony.bdk.gen.pod_model.group_item import GroupItem +from symphony.bdk.gen.pod_model.group_role_scope import GroupRoleScope +from symphony.bdk.gen.pod_model.im_system_info import IMSystemInfo +from symphony.bdk.gen.pod_model.immutable_room_attributes import ImmutableRoomAttributes +from symphony.bdk.gen.pod_model.languages import Languages +from symphony.bdk.gen.pod_model.member_info import MemberInfo +from symphony.bdk.gen.pod_model.membership_data import MembershipData +from symphony.bdk.gen.pod_model.message_detail import MessageDetail +from symphony.bdk.gen.pod_model.message_download_receipt_count import MessageDownloadReceiptCount +from symphony.bdk.gen.pod_model.message_ids import MessageIds +from symphony.bdk.gen.pod_model.message_metadata_response import MessageMetadataResponse +from symphony.bdk.gen.pod_model.message_metadata_response_parent import MessageMetadataResponseParent +from symphony.bdk.gen.pod_model.message_receipt_detail import MessageReceiptDetail +from symphony.bdk.gen.pod_model.message_receipt_detail_response import MessageReceiptDetailResponse +from symphony.bdk.gen.pod_model.message_status import MessageStatus +from symphony.bdk.gen.pod_model.message_status_user import MessageStatusUser +from symphony.bdk.gen.pod_model.message_stream import MessageStream +from symphony.bdk.gen.pod_model.message_suppression_response import MessageSuppressionResponse +from symphony.bdk.gen.pod_model.message_user import MessageUser +from symphony.bdk.gen.pod_model.name_value_pair import NameValuePair +from symphony.bdk.gen.pod_model.pagination import Pagination +from symphony.bdk.gen.pod_model.pagination_cursors import PaginationCursors +from symphony.bdk.gen.pod_model.password import Password +from symphony.bdk.gen.pod_model.password_reset import PasswordReset +from symphony.bdk.gen.pod_model.pod_app_entitlement import PodAppEntitlement +from symphony.bdk.gen.pod_model.pod_certificate import PodCertificate +from symphony.bdk.gen.pod_model.policy import Policy +from symphony.bdk.gen.pod_model.product import Product +from symphony.bdk.gen.pod_model.protocol import Protocol +from symphony.bdk.gen.pod_model.role import Role +from symphony.bdk.gen.pod_model.role_detail import RoleDetail +from symphony.bdk.gen.pod_model.room_attributes import RoomAttributes +from symphony.bdk.gen.pod_model.room_detail import RoomDetail +from symphony.bdk.gen.pod_model.room_search_criteria import RoomSearchCriteria +from symphony.bdk.gen.pod_model.room_specific_stream_attributes import RoomSpecificStreamAttributes +from symphony.bdk.gen.pod_model.room_system_info import RoomSystemInfo +from symphony.bdk.gen.pod_model.room_tag import RoomTag +from symphony.bdk.gen.pod_model.service_account_manifest import ServiceAccountManifest +from symphony.bdk.gen.pod_model.stream import Stream +from symphony.bdk.gen.pod_model.stream_attachment_item import StreamAttachmentItem +from symphony.bdk.gen.pod_model.stream_attributes import StreamAttributes +from symphony.bdk.gen.pod_model.stream_filter import StreamFilter +from symphony.bdk.gen.pod_model.stream_type import StreamType +from symphony.bdk.gen.pod_model.string_id import StringId +from symphony.bdk.gen.pod_model.success_response import SuccessResponse +from symphony.bdk.gen.pod_model.user_app_entitlement import UserAppEntitlement +from symphony.bdk.gen.pod_model.user_app_entitlement_patch import UserAppEntitlementPatch +from symphony.bdk.gen.pod_model.user_app_entitlement_patch_enum import UserAppEntitlementPatchEnum +from symphony.bdk.gen.pod_model.user_attributes import UserAttributes +from symphony.bdk.gen.pod_model.user_compp import UserCompp +from symphony.bdk.gen.pod_model.user_connection import UserConnection +from symphony.bdk.gen.pod_model.user_connection_request import UserConnectionRequest +from symphony.bdk.gen.pod_model.user_data import UserData +from symphony.bdk.gen.pod_model.user_detail import UserDetail +from symphony.bdk.gen.pod_model.user_error import UserError +from symphony.bdk.gen.pod_model.user_filter import UserFilter +from symphony.bdk.gen.pod_model.user_group_assignee import UserGroupAssignee +from symphony.bdk.gen.pod_model.user_group_assignee_response import UserGroupAssigneeResponse +from symphony.bdk.gen.pod_model.user_group_assignee_update import UserGroupAssigneeUpdate +from symphony.bdk.gen.pod_model.user_group_assignment_response import UserGroupAssignmentResponse +from symphony.bdk.gen.pod_model.user_group_create import UserGroupCreate +from symphony.bdk.gen.pod_model.user_group_data import UserGroupData +from symphony.bdk.gen.pod_model.user_group_membership_data import UserGroupMembershipData +from symphony.bdk.gen.pod_model.user_group_membership_request import UserGroupMembershipRequest +from symphony.bdk.gen.pod_model.user_group_membership_response import UserGroupMembershipResponse +from symphony.bdk.gen.pod_model.user_group_membership_response_data import UserGroupMembershipResponseData +from symphony.bdk.gen.pod_model.user_group_membership_update import UserGroupMembershipUpdate +from symphony.bdk.gen.pod_model.user_group_response import UserGroupResponse +from symphony.bdk.gen.pod_model.user_group_response_list import UserGroupResponseList +from symphony.bdk.gen.pod_model.user_group_update import UserGroupUpdate +from symphony.bdk.gen.pod_model.user_id import UserId +from symphony.bdk.gen.pod_model.user_info import UserInfo +from symphony.bdk.gen.pod_model.user_name import UserName +from symphony.bdk.gen.pod_model.user_search_filter import UserSearchFilter +from symphony.bdk.gen.pod_model.user_search_query import UserSearchQuery +from symphony.bdk.gen.pod_model.user_search_results import UserSearchResults +from symphony.bdk.gen.pod_model.user_status import UserStatus +from symphony.bdk.gen.pod_model.user_suspension import UserSuspension +from symphony.bdk.gen.pod_model.user_system_info import UserSystemInfo +from symphony.bdk.gen.pod_model.user_v2 import UserV2 +from symphony.bdk.gen.pod_model.v1_im_attributes import V1IMAttributes +from symphony.bdk.gen.pod_model.v1_im_detail import V1IMDetail +from symphony.bdk.gen.pod_model.v1_session import V1Session +from symphony.bdk.gen.pod_model.v1_user_sessions import V1UserSessions +from symphony.bdk.gen.pod_model.v2_admin_stream_attributes import V2AdminStreamAttributes +from symphony.bdk.gen.pod_model.v2_admin_stream_filter import V2AdminStreamFilter +from symphony.bdk.gen.pod_model.v2_admin_stream_info import V2AdminStreamInfo +from symphony.bdk.gen.pod_model.v2_admin_stream_list import V2AdminStreamList +from symphony.bdk.gen.pod_model.v2_admin_stream_type import V2AdminStreamType +from symphony.bdk.gen.pod_model.v2_conversation_specific_stream_attributes import V2ConversationSpecificStreamAttributes +from symphony.bdk.gen.pod_model.v2_member_info import V2MemberInfo +from symphony.bdk.gen.pod_model.v2_member_user_detail import V2MemberUserDetail +from symphony.bdk.gen.pod_model.v2_membership_list import V2MembershipList +from symphony.bdk.gen.pod_model.v2_presence import V2Presence +from symphony.bdk.gen.pod_model.v2_presence_status import V2PresenceStatus +from symphony.bdk.gen.pod_model.v2_room_search_criteria import V2RoomSearchCriteria +from symphony.bdk.gen.pod_model.v2_room_specific_stream_attributes import V2RoomSpecificStreamAttributes +from symphony.bdk.gen.pod_model.v2_stream_attributes import V2StreamAttributes +from symphony.bdk.gen.pod_model.v2_stream_type import V2StreamType +from symphony.bdk.gen.pod_model.v2_user_attributes import V2UserAttributes +from symphony.bdk.gen.pod_model.v2_user_create import V2UserCreate +from symphony.bdk.gen.pod_model.v2_user_detail import V2UserDetail +from symphony.bdk.gen.pod_model.v2_user_key_request import V2UserKeyRequest +from symphony.bdk.gen.pod_model.v2_user_list import V2UserList +from symphony.bdk.gen.pod_model.v2_user_presence import V2UserPresence +from symphony.bdk.gen.pod_model.v3_room_attributes import V3RoomAttributes +from symphony.bdk.gen.pod_model.v3_room_detail import V3RoomDetail +from symphony.bdk.gen.pod_model.v3_room_search_results import V3RoomSearchResults +from symphony.bdk.gen.group_model.add_member import AddMember +from symphony.bdk.gen.group_model.avatar import Avatar +from symphony.bdk.gen.group_model.base_group import BaseGroup +from symphony.bdk.gen.group_model.base_profile import BaseProfile +from symphony.bdk.gen.group_model.base_type import BaseType +from symphony.bdk.gen.group_model.create_group import CreateGroup +from symphony.bdk.gen.group_model.error import Error +from symphony.bdk.gen.group_model.group_implicit_connection import GroupImplicitConnection +from symphony.bdk.gen.group_model.group_interaction_transfer import GroupInteractionTransfer +from symphony.bdk.gen.group_model.group_list import GroupList +from symphony.bdk.gen.group_model.group_visibility_restriction import GroupVisibilityRestriction +from symphony.bdk.gen.group_model.implicit_connection import ImplicitConnection +from symphony.bdk.gen.group_model.interaction_control import InteractionControl +from symphony.bdk.gen.group_model.interaction_transfer import InteractionTransfer +from symphony.bdk.gen.group_model.member import Member +from symphony.bdk.gen.group_model.membership_control import MembershipControl +from symphony.bdk.gen.group_model.owner import Owner +from symphony.bdk.gen.group_model.pagination import Pagination +from symphony.bdk.gen.group_model.pagination_cursors import PaginationCursors +from symphony.bdk.gen.group_model.profile import Profile +from symphony.bdk.gen.group_model.profile_control import ProfileControl +from symphony.bdk.gen.group_model.read_group import ReadGroup +from symphony.bdk.gen.group_model.read_member import ReadMember +from symphony.bdk.gen.group_model.sort_order import SortOrder +from symphony.bdk.gen.group_model.status import Status +from symphony.bdk.gen.group_model.transfer_view import TransferView +from symphony.bdk.gen.group_model.type import Type +from symphony.bdk.gen.group_model.type_list import TypeList +from symphony.bdk.gen.group_model.update_group import UpdateGroup +from symphony.bdk.gen.group_model.upload_avatar import UploadAvatar +from symphony.bdk.gen.group_model.visibility_restriction import VisibilityRestriction diff --git a/symphony/bdk/gen/pod_api/__init__.py b/symphony/bdk/gen/pod_api/__init__.py deleted file mode 100644 index 74c41b15..00000000 --- a/symphony/bdk/gen/pod_api/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# do not import all apis into this module because that uses a lot of memory and stack frames diff --git a/symphony/bdk/gen/pod_api/app_entitlement_api.py b/symphony/bdk/gen/pod_api/app_entitlement_api.py index 672a77fb..05a3b618 100644 --- a/symphony/bdk/gen/pod_api/app_entitlement_api.py +++ b/symphony/bdk/gen/pod_api/app_entitlement_api.py @@ -1,734 +1,1518 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 +from pydantic import Field, StrictInt, StrictStr +from typing import List +from typing_extensions import Annotated +from symphony.bdk.gen.pod_model.pod_app_entitlement import PodAppEntitlement +from symphony.bdk.gen.pod_model.user_app_entitlement import UserAppEntitlement +from symphony.bdk.gen.pod_model.user_app_entitlement_patch import UserAppEntitlementPatch -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error -from symphony.bdk.gen.pod_model.pod_app_entitlement_list import PodAppEntitlementList -from symphony.bdk.gen.pod_model.user_app_entitlement_list import UserAppEntitlementList -from symphony.bdk.gen.pod_model.user_app_entitlements_patch_list import UserAppEntitlementsPatchList +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class AppEntitlementApi(object): +class AppEntitlementApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_admin_app_entitlement_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (PodAppEntitlementList,), - 'auth': [], - 'endpoint_path': '/v1/admin/app/entitlement/list', - 'operation_id': 'v1_admin_app_entitlement_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_app_entitlement_list_post_endpoint = _Endpoint( - settings={ - 'response_type': (PodAppEntitlementList,), - 'auth': [], - 'endpoint_path': '/v1/admin/app/entitlement/list', - 'operation_id': 'v1_admin_app_entitlement_list_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'payload', - ], - 'required': [ - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'payload': - (PodAppEntitlementList,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_user_uid_app_entitlement_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (UserAppEntitlementList,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/app/entitlement/list', - 'operation_id': 'v1_admin_user_uid_app_entitlement_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_user_uid_app_entitlement_list_patch_endpoint = _Endpoint( - settings={ - 'response_type': (UserAppEntitlementList,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/app/entitlement/list', - 'operation_id': 'v1_admin_user_uid_app_entitlement_list_patch', - 'http_method': 'PATCH', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'payload', - ], - 'required': [ - 'session_token', - 'uid', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'payload': - (UserAppEntitlementsPatchList,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_user_uid_app_entitlement_list_post_endpoint = _Endpoint( - settings={ - 'response_type': (UserAppEntitlementList,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/app/entitlement/list', - 'operation_id': 'v1_admin_user_uid_app_entitlement_list_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'payload', - ], - 'required': [ - 'session_token', - 'uid', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'payload': - (UserAppEntitlementList,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ + + + @validate_call + async def v1_admin_app_entitlement_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[PodAppEntitlement]: + """Get the list of application entitlements for the company + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_entitlement_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[PodAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_app_entitlement_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[PodAppEntitlement]]: + """Get the list of application entitlements for the company + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_entitlement_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[PodAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_app_entitlement_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the list of application entitlements for the company + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_entitlement_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[PodAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_app_entitlement_list_get_serialize( + self, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' ] - }, - api_client=api_client + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/app/entitlement/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def v1_admin_app_entitlement_list_get( + + + + @validate_call + async def v1_admin_app_entitlement_list_post( self, - session_token, - **kwargs - ): - """Get the list of application entitlements for the company # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_app_entitlement_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - PodAppEntitlementList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_admin_app_entitlement_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_app_entitlement_list_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: List[PodAppEntitlement], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[PodAppEntitlement]: + """Update the application entitlements for the company + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: List[PodAppEntitlement] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_entitlement_list_post_serialize( + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[PodAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_app_entitlement_list_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: List[PodAppEntitlement], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[PodAppEntitlement]]: + """Update the application entitlements for the company + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: List[PodAppEntitlement] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_entitlement_list_post_serialize( + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[PodAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_app_entitlement_list_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: List[PodAppEntitlement], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the application entitlements for the company + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: List[PodAppEntitlement] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_entitlement_list_post_serialize( + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[PodAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_app_entitlement_list_post_serialize( self, session_token, payload, - **kwargs - ): - """Update the application entitlements for the company # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_app_entitlement_list_post(session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - payload (PodAppEntitlementList): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - PodAppEntitlementList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v1_admin_app_entitlement_list_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_app_entitlement_list_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'payload': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/app/entitlement/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_app_entitlement_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[UserAppEntitlement]: + """Get the list of application entitlements for this user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_app_entitlement_list_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_app_entitlement_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[UserAppEntitlement]]: + """Get the list of application entitlements for this user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_app_entitlement_list_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_app_entitlement_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the list of application entitlements for this user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_app_entitlement_list_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_app_entitlement_list_get_serialize( self, session_token, uid, - **kwargs - ): - """Get the list of application entitlements for this user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_app_entitlement_list_get(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserAppEntitlementList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v1_admin_user_uid_app_entitlement_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_app_entitlement_list_patch( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/user/{uid}/app/entitlement/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_app_entitlement_list_patch( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + payload: List[UserAppEntitlementPatch], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[UserAppEntitlement]: + """Update unique entitlement of an app for this user. Entitlement can be installation, visibility or product + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: List[UserAppEntitlementPatch] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_app_entitlement_list_patch_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_app_entitlement_list_patch_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + payload: List[UserAppEntitlementPatch], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[UserAppEntitlement]]: + """Update unique entitlement of an app for this user. Entitlement can be installation, visibility or product + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: List[UserAppEntitlementPatch] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_app_entitlement_list_patch_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_app_entitlement_list_patch_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + payload: List[UserAppEntitlementPatch], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update unique entitlement of an app for this user. Entitlement can be installation, visibility or product + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: List[UserAppEntitlementPatch] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_app_entitlement_list_patch_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_app_entitlement_list_patch_serialize( self, session_token, uid, payload, - **kwargs - ): - """Update unique entitlement of an app for this user. Entitlement can be installation, visibility or product # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_app_entitlement_list_patch(session_token, uid, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - payload (UserAppEntitlementsPatchList): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserAppEntitlementList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['payload'] = \ - payload - return self.v1_admin_user_uid_app_entitlement_list_patch_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_app_entitlement_list_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'payload': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/v1/admin/user/{uid}/app/entitlement/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_app_entitlement_list_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + payload: List[UserAppEntitlement], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[UserAppEntitlement]: + """Update the application entitlements for this user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: List[UserAppEntitlement] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_app_entitlement_list_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_app_entitlement_list_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + payload: List[UserAppEntitlement], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[UserAppEntitlement]]: + """Update the application entitlements for this user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: List[UserAppEntitlement] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_app_entitlement_list_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_app_entitlement_list_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + payload: List[UserAppEntitlement], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the application entitlements for this user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: List[UserAppEntitlement] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_app_entitlement_list_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserAppEntitlement]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_app_entitlement_list_post_serialize( self, session_token, uid, payload, - **kwargs - ): - """Update the application entitlements for this user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_app_entitlement_list_post(session_token, uid, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - payload (UserAppEntitlementList): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserAppEntitlementList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['payload'] = \ - payload - return self.v1_admin_user_uid_app_entitlement_list_post_endpoint.call_with_http_info(**kwargs) + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'payload': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/user/{uid}/app/entitlement/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/application_api.py b/symphony/bdk/gen/pod_api/application_api.py index 5b1982e2..acbaa1a1 100644 --- a/symphony/bdk/gen/pod_api/application_api.py +++ b/symphony/bdk/gen/pod_api/application_api.py @@ -1,596 +1,1216 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) +from pydantic import Field, StrictStr +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.application_detail import ApplicationDetail -from symphony.bdk.gen.pod_model.error import Error from symphony.bdk.gen.pod_model.success_response import SuccessResponse +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class ApplicationApi(object): + +class ApplicationApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_admin_app_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (ApplicationDetail,), - 'auth': [], - 'endpoint_path': '/v1/admin/app/create', - 'operation_id': 'v1_admin_app_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'application_detail', - ], - 'required': [ - 'session_token', - 'application_detail', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'application_detail': - (ApplicationDetail,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'application_detail': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_app_id_delete_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/app/{id}/delete', - 'operation_id': 'v1_admin_app_id_delete_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'id', - ], - 'required': [ - 'session_token', - 'id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'id': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'id': 'id', - }, - 'location_map': { - 'session_token': 'header', - 'id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_app_id_get_get_endpoint = _Endpoint( - settings={ - 'response_type': (ApplicationDetail,), - 'auth': [], - 'endpoint_path': '/v1/admin/app/{id}/get', - 'operation_id': 'v1_admin_app_id_get_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'id', - ], - 'required': [ - 'session_token', - 'id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'id': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'id': 'id', - }, - 'location_map': { - 'session_token': 'header', - 'id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_app_id_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (ApplicationDetail,), - 'auth': [], - 'endpoint_path': '/v1/admin/app/{id}/update', - 'operation_id': 'v1_admin_app_id_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'id', - 'application_detail', - ], - 'required': [ - 'session_token', - 'id', - 'application_detail', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'id': - (str,), - 'application_detail': - (ApplicationDetail,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'id': 'id', - }, - 'location_map': { - 'session_token': 'header', - 'id': 'path', - 'application_detail': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client + + + @validate_call + async def v1_admin_app_create_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + application_detail: Annotated[ApplicationDetail, Field(description="Application detail to create the app with")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApplicationDetail: + """Creates a new app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param application_detail: Application detail to create the app with (required) + :type application_detail: ApplicationDetail + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_create_post_serialize( + session_token=session_token, + application_detail=application_detail, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApplicationDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - def v1_admin_app_create_post( + + @validate_call + async def v1_admin_app_create_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + application_detail: Annotated[ApplicationDetail, Field(description="Application detail to create the app with")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ApplicationDetail]: + """Creates a new app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param application_detail: Application detail to create the app with (required) + :type application_detail: ApplicationDetail + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_create_post_serialize( + session_token=session_token, + application_detail=application_detail, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApplicationDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_app_create_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + application_detail: Annotated[ApplicationDetail, Field(description="Application detail to create the app with")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Creates a new app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param application_detail: Application detail to create the app with (required) + :type application_detail: ApplicationDetail + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_create_post_serialize( + session_token=session_token, + application_detail=application_detail, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApplicationDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_app_create_post_serialize( self, session_token, application_detail, - **kwargs - ): - """Creates a new app # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_app_create_post(session_token, application_detail, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - application_detail (ApplicationDetail): Application detail to create the app with - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ApplicationDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['application_detail'] = \ - application_detail - return self.v1_admin_app_create_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_app_id_delete_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if application_detail is not None: + _body_params = application_detail + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/app/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_app_id_delete_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the app")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Deletes a app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the app (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_id_delete_post_serialize( + session_token=session_token, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_app_id_delete_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the app")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Deletes a app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the app (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_id_delete_post_serialize( + session_token=session_token, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_app_id_delete_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="The id of the app")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Deletes a app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: The id of the app (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_id_delete_post_serialize( + session_token=session_token, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_app_id_delete_post_serialize( self, session_token, id, - **kwargs - ): - """Deletes a app # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_app_id_delete_post(session_token, id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - id (str): The id of the app - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['id'] = \ - id - return self.v1_admin_app_id_delete_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_app_id_get_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/app/{id}/delete', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_app_id_get_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="the id of the app to get")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApplicationDetail: + """Gets a app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: the id of the app to get (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_id_get_get_serialize( + session_token=session_token, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApplicationDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_app_id_get_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="the id of the app to get")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ApplicationDetail]: + """Gets a app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: the id of the app to get (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_id_get_get_serialize( + session_token=session_token, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApplicationDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_app_id_get_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="the id of the app to get")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Gets a app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: the id of the app to get (required) + :type id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_id_get_get_serialize( + session_token=session_token, + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApplicationDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_app_id_get_get_serialize( self, session_token, id, - **kwargs - ): - """Gets a app # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_app_id_get_get(session_token, id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - id (str): the id of the app to get - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ApplicationDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['id'] = \ - id - return self.v1_admin_app_id_get_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_app_id_update_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/app/{id}/get', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_app_id_update_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="Id of the app")], + application_detail: Annotated[ApplicationDetail, Field(description="Details to update the app with")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApplicationDetail: + """Updates a app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: Id of the app (required) + :type id: str + :param application_detail: Details to update the app with (required) + :type application_detail: ApplicationDetail + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_id_update_post_serialize( + session_token=session_token, + id=id, + application_detail=application_detail, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApplicationDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_app_id_update_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="Id of the app")], + application_detail: Annotated[ApplicationDetail, Field(description="Details to update the app with")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ApplicationDetail]: + """Updates a app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: Id of the app (required) + :type id: str + :param application_detail: Details to update the app with (required) + :type application_detail: ApplicationDetail + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_id_update_post_serialize( + session_token=session_token, + id=id, + application_detail=application_detail, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApplicationDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_app_id_update_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + id: Annotated[StrictStr, Field(description="Id of the app")], + application_detail: Annotated[ApplicationDetail, Field(description="Details to update the app with")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Updates a app + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param id: Id of the app (required) + :type id: str + :param application_detail: Details to update the app with (required) + :type application_detail: ApplicationDetail + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_app_id_update_post_serialize( + session_token=session_token, + id=id, + application_detail=application_detail, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ApplicationDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_app_id_update_post_serialize( self, session_token, id, application_detail, - **kwargs - ): - """Updates a app # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_app_id_update_post(session_token, id, application_detail, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - id (str): Id of the app - application_detail (ApplicationDetail): Details to update the app with - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ApplicationDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['id'] = \ - id - kwargs['application_detail'] = \ - application_detail - return self.v1_admin_app_id_update_post_endpoint.call_with_http_info(**kwargs) + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if application_detail is not None: + _body_params = application_detail + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/app/{id}/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/connection_api.py b/symphony/bdk/gen/pod_api/connection_api.py index e3eeb850..2ebdeaa6 100644 --- a/symphony/bdk/gen/pod_api/connection_api.py +++ b/symphony/bdk/gen/pod_api/connection_api.py @@ -1,874 +1,1827 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt, StrictStr, field_validator +from typing import List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.success_response import SuccessResponse from symphony.bdk.gen.pod_model.user_connection import UserConnection -from symphony.bdk.gen.pod_model.user_connection_list import UserConnectionList from symphony.bdk.gen.pod_model.user_connection_request import UserConnectionRequest +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class ConnectionApi(object): +class ConnectionApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_connection_accept_post_endpoint = _Endpoint( - settings={ - 'response_type': (UserConnection,), - 'auth': [], - 'endpoint_path': '/v1/connection/accept', - 'operation_id': 'v1_connection_accept_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'connection_request', - ], - 'required': [ - 'session_token', - 'connection_request', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'connection_request': - (UserConnectionRequest,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'connection_request': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_connection_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (UserConnection,), - 'auth': [], - 'endpoint_path': '/v1/connection/create', - 'operation_id': 'v1_connection_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'connection_request', - ], - 'required': [ - 'session_token', - 'connection_request', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'connection_request': - (UserConnectionRequest,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'connection_request': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_connection_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (UserConnectionList,), - 'auth': [], - 'endpoint_path': '/v1/connection/list', - 'operation_id': 'v1_connection_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'status', - 'user_ids', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - 'status', - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - ('status',): { - - "PENDING_INCOMING": "PENDING_INCOMING", - "PENDING_OUTGOING": "PENDING_OUTGOING", - "ACCEPTED": "ACCEPTED", - "REJECTED": "REJECTED", - "ALL": "ALL" - }, - }, - 'openapi_types': { - 'session_token': - (str,), - 'status': - (str,), - 'user_ids': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'status': 'status', - 'user_ids': 'userIds', - }, - 'location_map': { - 'session_token': 'header', - 'status': 'query', - 'user_ids': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + + + @validate_call + async def v1_connection_accept_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + connection_request: UserConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserConnection: + """Accept the connection request for the requesting user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param connection_request: (required) + :type connection_request: UserConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_accept_post_serialize( + session_token=session_token, + connection_request=connection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_connection_accept_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + connection_request: UserConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserConnection]: + """Accept the connection request for the requesting user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param connection_request: (required) + :type connection_request: UserConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_accept_post_serialize( + session_token=session_token, + connection_request=connection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_connection_accept_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + connection_request: UserConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Accept the connection request for the requesting user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param connection_request: (required) + :type connection_request: UserConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_accept_post_serialize( + session_token=session_token, + connection_request=connection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_connection_accept_post_serialize( + self, + session_token, + connection_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if connection_request is not None: + _body_params = connection_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_connection_reject_post_endpoint = _Endpoint( - settings={ - 'response_type': (UserConnection,), - 'auth': [], - 'endpoint_path': '/v1/connection/reject', - 'operation_id': 'v1_connection_reject_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'connection_request', - ], - 'required': [ - 'session_token', - 'connection_request', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'connection_request': - (UserConnectionRequest,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'connection_request': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/connection/accept', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_connection_create_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + connection_request: UserConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserConnection: + """Sends an invitation to connect with another user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param connection_request: (required) + :type connection_request: UserConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_create_post_serialize( + session_token=session_token, + connection_request=connection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_connection_create_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + connection_request: UserConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserConnection]: + """Sends an invitation to connect with another user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param connection_request: (required) + :type connection_request: UserConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_create_post_serialize( + session_token=session_token, + connection_request=connection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_connection_create_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + connection_request: UserConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Sends an invitation to connect with another user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param connection_request: (required) + :type connection_request: UserConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_create_post_serialize( + session_token=session_token, + connection_request=connection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_connection_create_post_serialize( + self, + session_token, + connection_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if connection_request is not None: + _body_params = connection_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' ] - }, - api_client=api_client - ) - self.v1_connection_user_uid_remove_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/connection/user/{uid}/remove', - 'operation_id': 'v1_connection_user_uid_remove_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/connection/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_connection_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + status: Annotated[Optional[StrictStr], Field(description="Filter the connection list based on the connection status. The connection status can only be pending_incoming, pending_outgoing, accepted, rejected, or all (all of the above) ")] = None, + user_ids: Annotated[Optional[StrictStr], Field(description="The userIds parameter should be specified as a comma delimited list of user ids and can be used to restrict the results of a specific connection. Note that this is particularly important if the caller intends to retrieve results for implicit connection (user within the same pod). Implicit connections will not be included in the response if userId is not provided. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[UserConnection]: + """List of requesting user's connection + + This retrieves all connections of the requesting user. (i.e. both connections in which the requesting user is the sender and those in which the requesting user is the inivtee) By default, if you haven't specified the connection status to filter on, this call will only return results for both \"pending_incoming\" and \"pending_outgoing\". You can optionally filter by userIds to further restrict the results of a specific connection status. If the users are in the same private pod, the users have an implicit connection status of \"accepted\". Those users will not be returned in the response if you don't specify the connection status as \"accepted\" (default is \"pending\") and the explicit userIds in the request. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param status: Filter the connection list based on the connection status. The connection status can only be pending_incoming, pending_outgoing, accepted, rejected, or all (all of the above) + :type status: str + :param user_ids: The userIds parameter should be specified as a comma delimited list of user ids and can be used to restrict the results of a specific connection. Note that this is particularly important if the caller intends to retrieve results for implicit connection (user within the same pod). Implicit connections will not be included in the response if userId is not provided. + :type user_ids: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_list_get_serialize( + session_token=session_token, + status=status, + user_ids=user_ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserConnection]", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_connection_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + status: Annotated[Optional[StrictStr], Field(description="Filter the connection list based on the connection status. The connection status can only be pending_incoming, pending_outgoing, accepted, rejected, or all (all of the above) ")] = None, + user_ids: Annotated[Optional[StrictStr], Field(description="The userIds parameter should be specified as a comma delimited list of user ids and can be used to restrict the results of a specific connection. Note that this is particularly important if the caller intends to retrieve results for implicit connection (user within the same pod). Implicit connections will not be included in the response if userId is not provided. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[UserConnection]]: + """List of requesting user's connection + + This retrieves all connections of the requesting user. (i.e. both connections in which the requesting user is the sender and those in which the requesting user is the inivtee) By default, if you haven't specified the connection status to filter on, this call will only return results for both \"pending_incoming\" and \"pending_outgoing\". You can optionally filter by userIds to further restrict the results of a specific connection status. If the users are in the same private pod, the users have an implicit connection status of \"accepted\". Those users will not be returned in the response if you don't specify the connection status as \"accepted\" (default is \"pending\") and the explicit userIds in the request. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param status: Filter the connection list based on the connection status. The connection status can only be pending_incoming, pending_outgoing, accepted, rejected, or all (all of the above) + :type status: str + :param user_ids: The userIds parameter should be specified as a comma delimited list of user ids and can be used to restrict the results of a specific connection. Note that this is particularly important if the caller intends to retrieve results for implicit connection (user within the same pod). Implicit connections will not be included in the response if userId is not provided. + :type user_ids: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_list_get_serialize( + session_token=session_token, + status=status, + user_ids=user_ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserConnection]", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_connection_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + status: Annotated[Optional[StrictStr], Field(description="Filter the connection list based on the connection status. The connection status can only be pending_incoming, pending_outgoing, accepted, rejected, or all (all of the above) ")] = None, + user_ids: Annotated[Optional[StrictStr], Field(description="The userIds parameter should be specified as a comma delimited list of user ids and can be used to restrict the results of a specific connection. Note that this is particularly important if the caller intends to retrieve results for implicit connection (user within the same pod). Implicit connections will not be included in the response if userId is not provided. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List of requesting user's connection + + This retrieves all connections of the requesting user. (i.e. both connections in which the requesting user is the sender and those in which the requesting user is the inivtee) By default, if you haven't specified the connection status to filter on, this call will only return results for both \"pending_incoming\" and \"pending_outgoing\". You can optionally filter by userIds to further restrict the results of a specific connection status. If the users are in the same private pod, the users have an implicit connection status of \"accepted\". Those users will not be returned in the response if you don't specify the connection status as \"accepted\" (default is \"pending\") and the explicit userIds in the request. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param status: Filter the connection list based on the connection status. The connection status can only be pending_incoming, pending_outgoing, accepted, rejected, or all (all of the above) + :type status: str + :param user_ids: The userIds parameter should be specified as a comma delimited list of user ids and can be used to restrict the results of a specific connection. Note that this is particularly important if the caller intends to retrieve results for implicit connection (user within the same pod). Implicit connections will not be included in the response if userId is not provided. + :type user_ids: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_list_get_serialize( + session_token=session_token, + status=status, + user_ids=user_ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserConnection]", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_connection_list_get_serialize( + self, + session_token, + status, + user_ids, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if status is not None: + + _query_params.append(('status', status)) + + if user_ids is not None: + + _query_params.append(('userIds', user_ids)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_connection_user_user_id_info_get_endpoint = _Endpoint( - settings={ - 'response_type': (UserConnection,), - 'auth': [], - 'endpoint_path': '/v1/connection/user/{userId}/info', - 'operation_id': 'v1_connection_user_user_id_info_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'user_id', - ], - 'required': [ - 'session_token', - 'user_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'user_id': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'user_id': 'userId', - }, - 'location_map': { - 'session_token': 'header', - 'user_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/connection/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def v1_connection_accept_post( + + + + @validate_call + async def v1_connection_reject_post( self, - session_token, - connection_request, - **kwargs - ): - """Accept the connection request for the requesting user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_connection_accept_post(session_token, connection_request, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - connection_request (UserConnectionRequest): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserConnection - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['connection_request'] = \ - connection_request - return self.v1_connection_accept_post_endpoint.call_with_http_info(**kwargs) - - def v1_connection_create_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + connection_request: UserConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserConnection: + """Reject the connection request for the requesting user. + + Reject the connection between the requesting user and request sender. If both users are in the same private pod, an error will be returned because both users have an implicit connection which cannot be rejected. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param connection_request: (required) + :type connection_request: UserConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_reject_post_serialize( + session_token=session_token, + connection_request=connection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_connection_reject_post_with_http_info( self, - session_token, - connection_request, - **kwargs - ): - """Sends an invitation to connect with another user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_connection_create_post(session_token, connection_request, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - connection_request (UserConnectionRequest): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserConnection - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['connection_request'] = \ - connection_request - return self.v1_connection_create_post_endpoint.call_with_http_info(**kwargs) - - def v1_connection_list_get( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + connection_request: UserConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserConnection]: + """Reject the connection request for the requesting user. + + Reject the connection between the requesting user and request sender. If both users are in the same private pod, an error will be returned because both users have an implicit connection which cannot be rejected. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param connection_request: (required) + :type connection_request: UserConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_reject_post_serialize( + session_token=session_token, + connection_request=connection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_connection_reject_post_without_preload_content( self, - session_token, - **kwargs - ): - """List of requesting user's connection # noqa: E501 - - This retrieves all connections of the requesting user. (i.e. both connections in which the requesting user is the sender and those in which the requesting user is the inivtee) By default, if you haven't specified the connection status to filter on, this call will only return results for both \"pending_incoming\" and \"pending_outgoing\". You can optionally filter by userIds to further restrict the results of a specific connection status. If the users are in the same private pod, the users have an implicit connection status of \"accepted\". Those users will not be returned in the response if you don't specify the connection status as \"accepted\" (default is \"pending\") and the explicit userIds in the request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_connection_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - status (str): Filter the connection list based on the connection status. The connection status can only be pending_incoming, pending_outgoing, accepted, rejected, or all (all of the above) . [optional] - user_ids (str): The userIds parameter should be specified as a comma delimited list of user ids and can be used to restrict the results of a specific connection. Note that this is particularly important if the caller intends to retrieve results for implicit connection (user within the same pod). Implicit connections will not be included in the response if userId is not provided. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserConnectionList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_connection_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_connection_reject_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + connection_request: UserConnectionRequest, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Reject the connection request for the requesting user. + + Reject the connection between the requesting user and request sender. If both users are in the same private pod, an error will be returned because both users have an implicit connection which cannot be rejected. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param connection_request: (required) + :type connection_request: UserConnectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_reject_post_serialize( + session_token=session_token, + connection_request=connection_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_connection_reject_post_serialize( self, session_token, connection_request, - **kwargs - ): - """Reject the connection request for the requesting user. # noqa: E501 - - Reject the connection between the requesting user and request sender. If both users are in the same private pod, an error will be returned because both users have an implicit connection which cannot be rejected. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_connection_reject_post(session_token, connection_request, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - connection_request (UserConnectionRequest): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserConnection - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['connection_request'] = \ - connection_request - return self.v1_connection_reject_post_endpoint.call_with_http_info(**kwargs) - - def v1_connection_user_uid_remove_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if connection_request is not None: + _body_params = connection_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/connection/reject', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_connection_user_uid_remove_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Removes a connection with a user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_user_uid_remove_post_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_connection_user_uid_remove_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Removes a connection with a user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_user_uid_remove_post_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_connection_user_uid_remove_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Removes a connection with a user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_user_uid_remove_post_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_connection_user_uid_remove_post_serialize( self, session_token, uid, - **kwargs - ): - """Removes a connection with a user. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_connection_user_uid_remove_post(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v1_connection_user_uid_remove_post_endpoint.call_with_http_info(**kwargs) - - def v1_connection_user_user_id_info_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/connection/user/{uid}/remove', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_connection_user_user_id_info_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + user_id: Annotated[StrictStr, Field(description="user Id")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserConnection: + """The status of the connection invitation to another user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param user_id: user Id (required) + :type user_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_user_user_id_info_get_serialize( + session_token=session_token, + user_id=user_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_connection_user_user_id_info_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + user_id: Annotated[StrictStr, Field(description="user Id")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserConnection]: + """The status of the connection invitation to another user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param user_id: user Id (required) + :type user_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_user_user_id_info_get_serialize( + session_token=session_token, + user_id=user_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_connection_user_user_id_info_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + user_id: Annotated[StrictStr, Field(description="user Id")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """The status of the connection invitation to another user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param user_id: user Id (required) + :type user_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_connection_user_user_id_info_get_serialize( + session_token=session_token, + user_id=user_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserConnection", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_connection_user_user_id_info_get_serialize( self, session_token, user_id, - **kwargs - ): - """The status of the connection invitation to another user. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_connection_user_user_id_info_get(session_token, user_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - user_id (str): user Id - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserConnection - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['user_id'] = \ - user_id - return self.v1_connection_user_user_id_info_get_endpoint.call_with_http_info(**kwargs) + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user_id is not None: + _path_params['userId'] = user_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/connection/user/{userId}/info', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/default_api.py b/symphony/bdk/gen/pod_api/default_api.py index 7b90145f..7360cce2 100644 --- a/symphony/bdk/gen/pod_api/default_api.py +++ b/symphony/bdk/gen/pod_api/default_api.py @@ -1,893 +1,1877 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.file_extension import FileExtension from symphony.bdk.gen.pod_model.file_extensions_response import FileExtensionsResponse -from symphony.bdk.gen.pod_model.message_details import MessageDetails +from symphony.bdk.gen.pod_model.message_detail import MessageDetail from symphony.bdk.gen.pod_model.message_ids import MessageIds from symphony.bdk.gen.pod_model.message_metadata_response import MessageMetadataResponse from symphony.bdk.gen.pod_model.message_receipt_detail_response import MessageReceiptDetailResponse +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class DefaultApi(object): +class DefaultApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.delete_allowed_file_extension_endpoint = _Endpoint( - settings={ - 'response_type': None, - 'auth': [], - 'endpoint_path': '/file_ext/v1/allowed_extensions/{extension}', - 'operation_id': 'delete_allowed_file_extension', - 'http_method': 'DELETE', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'extension', - ], - 'required': [ - 'session_token', - 'extension', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'extension': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'extension': 'extension', - }, - 'location_map': { - 'session_token': 'header', - 'extension': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.list_allowed_file_extensions_endpoint = _Endpoint( - settings={ - 'response_type': (FileExtensionsResponse,), - 'auth': [], - 'endpoint_path': '/file_ext/v1/allowed_extensions', - 'operation_id': 'list_allowed_file_extensions', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'limit', - 'before', - 'after', - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'limit': - (int,), - 'before': - (str,), - 'after': - (str,), - }, - 'attribute_map': { - 'limit': 'limit', - 'before': 'before', - 'after': 'after', - }, - 'location_map': { - 'limit': 'query', - 'before': 'query', - 'after': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.put_allowed_file_extension_endpoint = _Endpoint( - settings={ - 'response_type': (FileExtension,), - 'auth': [], - 'endpoint_path': '/file_ext/v1/allowed_extensions/{extension}', - 'operation_id': 'put_allowed_file_extension', - 'http_method': 'PUT', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'extension', - 'v3_file_extension', - ], - 'required': [ - 'session_token', - 'extension', - 'v3_file_extension', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'extension': - (str,), - 'v3_file_extension': - (FileExtension,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'extension': 'extension', - }, - 'location_map': { - 'session_token': 'header', - 'extension': 'path', - 'v3_file_extension': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_messages_message_id_metadata_relationships_get_endpoint = _Endpoint( - settings={ - 'response_type': (MessageMetadataResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/messages/{messageId}/metadata/relationships', - 'operation_id': 'v1_admin_messages_message_id_metadata_relationships_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'user_agent', - 'message_id', - ], - 'required': [ - 'session_token', - 'user_agent', - 'message_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'user_agent': - (str,), - 'message_id': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'user_agent': 'User-Agent', - 'message_id': 'messageId', - }, - 'location_map': { - 'session_token': 'header', - 'user_agent': 'header', - 'message_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_messages_message_id_receipts_get_endpoint = _Endpoint( - settings={ - 'response_type': (MessageReceiptDetailResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/messages/{messageId}/receipts', - 'operation_id': 'v1_admin_messages_message_id_receipts_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'message_id', - 'before', - 'after', - ], - 'required': [ - 'session_token', - 'message_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'message_id': - (str,), - 'before': - (str,), - 'after': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'message_id': 'messageId', - 'before': 'before', - 'after': 'after', - }, - 'location_map': { - 'session_token': 'header', - 'message_id': 'path', - 'before': 'query', - 'after': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + + + @validate_call + async def delete_allowed_file_extension( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + extension: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Allows deletion of a specific file extension supported for upload + + Provides a method to delete a specific file extension configured for upload support via an admin. The file extension identifying the resource is treated case-insensitively by the API. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param extension: (required) + :type extension: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_allowed_file_extension_serialize( + session_token=session_token, + extension=extension, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def delete_allowed_file_extension_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + extension: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Allows deletion of a specific file extension supported for upload + + Provides a method to delete a specific file extension configured for upload support via an admin. The file extension identifying the resource is treated case-insensitively by the API. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param extension: (required) + :type extension: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_allowed_file_extension_serialize( + session_token=session_token, + extension=extension, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def delete_allowed_file_extension_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + extension: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Allows deletion of a specific file extension supported for upload + + Provides a method to delete a specific file extension configured for upload support via an admin. The file extension identifying the resource is treated case-insensitively by the API. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param extension: (required) + :type extension: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_allowed_file_extension_serialize( + session_token=session_token, + extension=extension, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_allowed_file_extension_serialize( + self, + session_token, + extension, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if extension is not None: + _path_params['extension'] = extension + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_messages_post_endpoint = _Endpoint( - settings={ - 'response_type': (MessageDetails,), - 'auth': [], - 'endpoint_path': '/v1/admin/messages', - 'operation_id': 'v1_admin_messages_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'message_ids', - ], - 'required': [ - 'session_token', - 'message_ids', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'message_ids': - (MessageIds,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'message_ids': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/file_ext/v1/allowed_extensions/{extension}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def list_allowed_file_extensions( + self, + limit: Annotated[Optional[StrictInt], Field(description="This is the maximum number of objects that may be returned. A query may return fewer than the value of limit due to filtering or service-side maximums. Do not depend on the number of results being fewer than the limit value to indicate your query reached the end of the list of data, use the absence of next instead as described below. For example, if you set limit to 10 and 9 results are returned, there may be more data available, but one item was removed due to privacy filtering. Some maximums for limit may be enforced for performance reasons. In all cases, the API returns the correct pagination links. ")] = None, + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque \"before\" cursor value as presented via a response cursor ")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque \"after\" cursor value as presented via a response cursor ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FileExtensionsResponse: + """Allows iteration of all file extensions supported for upload + + Provides a RESTful API to iterate all file extensions configured by the tenant admin that are allowed for the upload. Pagination of this list is managed through a combination of the optional request parameters and service-side managed maximums. Pagination of the results is provided through the before or after input paramters and presented through the opaque cursor values provided as output from a previous response. Only one of before or after or neither may be provided. DO NOT store cursors. Cursors can quickly become invalid if items are added or deleted. Use them only during a short-period of time that you are traversing the list. + + :param limit: This is the maximum number of objects that may be returned. A query may return fewer than the value of limit due to filtering or service-side maximums. Do not depend on the number of results being fewer than the limit value to indicate your query reached the end of the list of data, use the absence of next instead as described below. For example, if you set limit to 10 and 9 results are returned, there may be more data available, but one item was removed due to privacy filtering. Some maximums for limit may be enforced for performance reasons. In all cases, the API returns the correct pagination links. + :type limit: int + :param before: Returns results from an opaque \"before\" cursor value as presented via a response cursor + :type before: str + :param after: Returns results from an opaque \"after\" cursor value as presented via a response cursor + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_allowed_file_extensions_serialize( + limit=limit, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FileExtensionsResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + '503': None, + '504': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def list_allowed_file_extensions_with_http_info( + self, + limit: Annotated[Optional[StrictInt], Field(description="This is the maximum number of objects that may be returned. A query may return fewer than the value of limit due to filtering or service-side maximums. Do not depend on the number of results being fewer than the limit value to indicate your query reached the end of the list of data, use the absence of next instead as described below. For example, if you set limit to 10 and 9 results are returned, there may be more data available, but one item was removed due to privacy filtering. Some maximums for limit may be enforced for performance reasons. In all cases, the API returns the correct pagination links. ")] = None, + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque \"before\" cursor value as presented via a response cursor ")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque \"after\" cursor value as presented via a response cursor ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FileExtensionsResponse]: + """Allows iteration of all file extensions supported for upload + + Provides a RESTful API to iterate all file extensions configured by the tenant admin that are allowed for the upload. Pagination of this list is managed through a combination of the optional request parameters and service-side managed maximums. Pagination of the results is provided through the before or after input paramters and presented through the opaque cursor values provided as output from a previous response. Only one of before or after or neither may be provided. DO NOT store cursors. Cursors can quickly become invalid if items are added or deleted. Use them only during a short-period of time that you are traversing the list. + + :param limit: This is the maximum number of objects that may be returned. A query may return fewer than the value of limit due to filtering or service-side maximums. Do not depend on the number of results being fewer than the limit value to indicate your query reached the end of the list of data, use the absence of next instead as described below. For example, if you set limit to 10 and 9 results are returned, there may be more data available, but one item was removed due to privacy filtering. Some maximums for limit may be enforced for performance reasons. In all cases, the API returns the correct pagination links. + :type limit: int + :param before: Returns results from an opaque \"before\" cursor value as presented via a response cursor + :type before: str + :param after: Returns results from an opaque \"after\" cursor value as presented via a response cursor + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_allowed_file_extensions_serialize( + limit=limit, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FileExtensionsResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + '503': None, + '504': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def list_allowed_file_extensions_without_preload_content( + self, + limit: Annotated[Optional[StrictInt], Field(description="This is the maximum number of objects that may be returned. A query may return fewer than the value of limit due to filtering or service-side maximums. Do not depend on the number of results being fewer than the limit value to indicate your query reached the end of the list of data, use the absence of next instead as described below. For example, if you set limit to 10 and 9 results are returned, there may be more data available, but one item was removed due to privacy filtering. Some maximums for limit may be enforced for performance reasons. In all cases, the API returns the correct pagination links. ")] = None, + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque \"before\" cursor value as presented via a response cursor ")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque \"after\" cursor value as presented via a response cursor ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Allows iteration of all file extensions supported for upload + + Provides a RESTful API to iterate all file extensions configured by the tenant admin that are allowed for the upload. Pagination of this list is managed through a combination of the optional request parameters and service-side managed maximums. Pagination of the results is provided through the before or after input paramters and presented through the opaque cursor values provided as output from a previous response. Only one of before or after or neither may be provided. DO NOT store cursors. Cursors can quickly become invalid if items are added or deleted. Use them only during a short-period of time that you are traversing the list. + + :param limit: This is the maximum number of objects that may be returned. A query may return fewer than the value of limit due to filtering or service-side maximums. Do not depend on the number of results being fewer than the limit value to indicate your query reached the end of the list of data, use the absence of next instead as described below. For example, if you set limit to 10 and 9 results are returned, there may be more data available, but one item was removed due to privacy filtering. Some maximums for limit may be enforced for performance reasons. In all cases, the API returns the correct pagination links. + :type limit: int + :param before: Returns results from an opaque \"before\" cursor value as presented via a response cursor + :type before: str + :param after: Returns results from an opaque \"after\" cursor value as presented via a response cursor + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_allowed_file_extensions_serialize( + limit=limit, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FileExtensionsResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + '503': None, + '504': None, + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_allowed_file_extensions_serialize( + self, + limit, + before, + after, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if before is not None: + + _query_params.append(('before', before)) + + if after is not None: + + _query_params.append(('after', after)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' ] - }, - api_client=api_client + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/file_ext/v1/allowed_extensions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def delete_allowed_file_extension( + + + + @validate_call + async def put_allowed_file_extension( self, - session_token, - extension, - **kwargs - ): - """Allows deletion of a specific file extension supported for upload # noqa: E501 - - Provides a method to delete a specific file extension configured for upload support via an admin. The file extension identifying the resource is treated case-insensitively by the API. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.delete_allowed_file_extension(session_token, extension, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - extension (str): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['extension'] = \ - extension - return self.delete_allowed_file_extension_endpoint.call_with_http_info(**kwargs) - - def list_allowed_file_extensions( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + extension: StrictStr, + v3_file_extension: FileExtension, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FileExtension: + """Allows replacement or creation of a specific file extension supported for upload + + Provides a method to create or replace a specific file extension configured for upload support via an admin. The API treats the file extension in the path case-insensitively by converting it to lowecase. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param extension: (required) + :type extension: str + :param v3_file_extension: (required) + :type v3_file_extension: FileExtension + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._put_allowed_file_extension_serialize( + session_token=session_token, + extension=extension, + v3_file_extension=v3_file_extension, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FileExtension", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def put_allowed_file_extension_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + extension: StrictStr, + v3_file_extension: FileExtension, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FileExtension]: + """Allows replacement or creation of a specific file extension supported for upload + + Provides a method to create or replace a specific file extension configured for upload support via an admin. The API treats the file extension in the path case-insensitively by converting it to lowecase. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param extension: (required) + :type extension: str + :param v3_file_extension: (required) + :type v3_file_extension: FileExtension + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._put_allowed_file_extension_serialize( + session_token=session_token, + extension=extension, + v3_file_extension=v3_file_extension, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FileExtension", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def put_allowed_file_extension_without_preload_content( self, - **kwargs - ): - """Allows iteration of all file extensions supported for upload # noqa: E501 - - Provides a RESTful API to iterate all file extensions configured by the tenant admin that are allowed for the upload. Pagination of this list is managed through a combination of the optional request parameters and service-side managed maximums. Pagination of the results is provided through the before or after input paramters and presented through the opaque cursor values provided as output from a previous response. Only one of before or after or neither may be provided. DO NOT store cursors. Cursors can quickly become invalid if items are added or deleted. Use them only during a short-period of time that you are traversing the list. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.list_allowed_file_extensions(async_req=True) - >>> result = thread.get() - - - Keyword Args: - limit (int): This is the maximum number of objects that may be returned. A query may return fewer than the value of limit due to filtering or service-side maximums. Do not depend on the number of results being fewer than the limit value to indicate your query reached the end of the list of data, use the absence of next instead as described below. For example, if you set limit to 10 and 9 results are returned, there may be more data available, but one item was removed due to privacy filtering. Some maximums for limit may be enforced for performance reasons. In all cases, the API returns the correct pagination links. . [optional] - before (str): Returns results from an opaque \"before\" cursor value as presented via a response cursor . [optional] - after (str): Returns results from an opaque \"after\" cursor value as presented via a response cursor . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - FileExtensionsResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.list_allowed_file_extensions_endpoint.call_with_http_info(**kwargs) - - def put_allowed_file_extension( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + extension: StrictStr, + v3_file_extension: FileExtension, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Allows replacement or creation of a specific file extension supported for upload + + Provides a method to create or replace a specific file extension configured for upload support via an admin. The API treats the file extension in the path case-insensitively by converting it to lowecase. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param extension: (required) + :type extension: str + :param v3_file_extension: (required) + :type v3_file_extension: FileExtension + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._put_allowed_file_extension_serialize( + session_token=session_token, + extension=extension, + v3_file_extension=v3_file_extension, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FileExtension", + '400': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _put_allowed_file_extension_serialize( self, session_token, extension, v3_file_extension, - **kwargs - ): - """Allows replacement or creation of a specific file extension supported for upload # noqa: E501 - - Provides a method to create or replace a specific file extension configured for upload support via an admin. The API treats the file extension in the path case-insensitively by converting it to lowecase. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.put_allowed_file_extension(session_token, extension, v3_file_extension, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - extension (str): - v3_file_extension (FileExtension): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - FileExtension - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['extension'] = \ - extension - kwargs['v3_file_extension'] = \ - v3_file_extension - return self.put_allowed_file_extension_endpoint.call_with_http_info(**kwargs) - - def v1_admin_messages_message_id_metadata_relationships_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if extension is not None: + _path_params['extension'] = extension + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if v3_file_extension is not None: + _body_params = v3_file_extension + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/file_ext/v1/allowed_extensions/{extension}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_messages_message_id_metadata_relationships_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + user_agent: Annotated[StrictStr, Field(description="Request user agent.")], + message_id: Annotated[StrictStr, Field(description="Valid id of a SOCIALMESSAGE")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MessageMetadataResponse: + """Get the message metadata relationship + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param user_agent: Request user agent. (required) + :type user_agent: str + :param message_id: Valid id of a SOCIALMESSAGE (required) + :type message_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messages_message_id_metadata_relationships_get_serialize( + session_token=session_token, + user_agent=user_agent, + message_id=message_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_messages_message_id_metadata_relationships_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + user_agent: Annotated[StrictStr, Field(description="Request user agent.")], + message_id: Annotated[StrictStr, Field(description="Valid id of a SOCIALMESSAGE")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MessageMetadataResponse]: + """Get the message metadata relationship + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param user_agent: Request user agent. (required) + :type user_agent: str + :param message_id: Valid id of a SOCIALMESSAGE (required) + :type message_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messages_message_id_metadata_relationships_get_serialize( + session_token=session_token, + user_agent=user_agent, + message_id=message_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_messages_message_id_metadata_relationships_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + user_agent: Annotated[StrictStr, Field(description="Request user agent.")], + message_id: Annotated[StrictStr, Field(description="Valid id of a SOCIALMESSAGE")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the message metadata relationship + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param user_agent: Request user agent. (required) + :type user_agent: str + :param message_id: Valid id of a SOCIALMESSAGE (required) + :type message_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messages_message_id_metadata_relationships_get_serialize( + session_token=session_token, + user_agent=user_agent, + message_id=message_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageMetadataResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_messages_message_id_metadata_relationships_get_serialize( self, session_token, user_agent, message_id, - **kwargs - ): - """Get the message metadata relationship # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_messages_message_id_metadata_relationships_get(session_token, user_agent, message_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - user_agent (str): Request user agent. - message_id (str): Valid id of a SOCIALMESSAGE - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - MessageMetadataResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['user_agent'] = \ - user_agent - kwargs['message_id'] = \ - message_id - return self.v1_admin_messages_message_id_metadata_relationships_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_messages_message_id_receipts_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if message_id is not None: + _path_params['messageId'] = message_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + if user_agent is not None: + _header_params['User-Agent'] = user_agent + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/messages/{messageId}/metadata/relationships', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_messages_message_id_receipts_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_id: Annotated[StrictStr, Field(description="The message ID")], + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “after” cursor value as presented via a response cursor.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MessageReceiptDetailResponse: + """Fetch receipts details from a specific message. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_id: The message ID (required) + :type message_id: str + :param before: Returns results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Returns results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messages_message_id_receipts_get_serialize( + session_token=session_token, + message_id=message_id, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageReceiptDetailResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_messages_message_id_receipts_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_id: Annotated[StrictStr, Field(description="The message ID")], + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “after” cursor value as presented via a response cursor.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MessageReceiptDetailResponse]: + """Fetch receipts details from a specific message. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_id: The message ID (required) + :type message_id: str + :param before: Returns results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Returns results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messages_message_id_receipts_get_serialize( + session_token=session_token, + message_id=message_id, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageReceiptDetailResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_messages_message_id_receipts_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + message_id: Annotated[StrictStr, Field(description="The message ID")], + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “after” cursor value as presented via a response cursor.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Fetch receipts details from a specific message. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param message_id: The message ID (required) + :type message_id: str + :param before: Returns results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Returns results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messages_message_id_receipts_get_serialize( + session_token=session_token, + message_id=message_id, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageReceiptDetailResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_messages_message_id_receipts_get_serialize( self, session_token, message_id, - **kwargs - ): - """Fetch receipts details from a specific message. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_messages_message_id_receipts_get(session_token, message_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - message_id (str): The message ID - - Keyword Args: - before (str): Returns results from an opaque “before” cursor value as presented via a response cursor.. [optional] - after (str): Returns results from an opaque “after” cursor value as presented via a response cursor.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - MessageReceiptDetailResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['message_id'] = \ - message_id - return self.v1_admin_messages_message_id_receipts_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_messages_post( + before, + after, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if message_id is not None: + _path_params['messageId'] = message_id + # process the query parameters + if before is not None: + + _query_params.append(('before', before)) + + if after is not None: + + _query_params.append(('after', after)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/messages/{messageId}/receipts', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_messages_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token")], + message_ids: Annotated[MessageIds, Field(description="the ids of the messages to be fetched")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[MessageDetail]: + """Fetch message details + + + :param session_token: Session authentication token (required) + :type session_token: str + :param message_ids: the ids of the messages to be fetched (required) + :type message_ids: MessageIds + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messages_post_serialize( + session_token=session_token, + message_ids=message_ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[MessageDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_messages_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token")], + message_ids: Annotated[MessageIds, Field(description="the ids of the messages to be fetched")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[MessageDetail]]: + """Fetch message details + + + :param session_token: Session authentication token (required) + :type session_token: str + :param message_ids: the ids of the messages to be fetched (required) + :type message_ids: MessageIds + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messages_post_serialize( + session_token=session_token, + message_ids=message_ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[MessageDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_messages_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token")], + message_ids: Annotated[MessageIds, Field(description="the ids of the messages to be fetched")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Fetch message details + + + :param session_token: Session authentication token (required) + :type session_token: str + :param message_ids: the ids of the messages to be fetched (required) + :type message_ids: MessageIds + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messages_post_serialize( + session_token=session_token, + message_ids=message_ids, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[MessageDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '422': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_messages_post_serialize( self, session_token, message_ids, - **kwargs - ): - """Fetch message details # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_messages_post(session_token, message_ids, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token - message_ids (MessageIds): the ids of the messages to be fetched - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - MessageDetails - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['message_ids'] = \ - message_ids - return self.v1_admin_messages_post_endpoint.call_with_http_info(**kwargs) + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if message_ids is not None: + _body_params = message_ids + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/messages', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/disclaimer_api.py b/symphony/bdk/gen/pod_api/disclaimer_api.py index 64b546e7..10e057da 100644 --- a/symphony/bdk/gen/pod_api/disclaimer_api.py +++ b/symphony/bdk/gen/pod_api/disclaimer_api.py @@ -1,439 +1,876 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) +from pydantic import Field, StrictInt, StrictStr +from typing import List +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.disclaimer import Disclaimer -from symphony.bdk.gen.pod_model.disclaimer_list import DisclaimerList -from symphony.bdk.gen.pod_model.error import Error -from symphony.bdk.gen.pod_model.user_id_list import UserIdList + +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class DisclaimerApi(object): +class DisclaimerApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_admin_disclaimer_did_get_endpoint = _Endpoint( - settings={ - 'response_type': (Disclaimer,), - 'auth': [], - 'endpoint_path': '/v1/admin/disclaimer/{did}', - 'operation_id': 'v1_admin_disclaimer_did_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'did', - ], - 'required': [ - 'session_token', - 'did', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'did': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'did': 'did', - }, - 'location_map': { - 'session_token': 'header', - 'did': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_disclaimer_did_users_get_endpoint = _Endpoint( - settings={ - 'response_type': (UserIdList,), - 'auth': [], - 'endpoint_path': '/v1/admin/disclaimer/{did}/users', - 'operation_id': 'v1_admin_disclaimer_did_users_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'did', - ], - 'required': [ - 'session_token', - 'did', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'did': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'did': 'did', - }, - 'location_map': { - 'session_token': 'header', - 'did': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_disclaimer_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (DisclaimerList,), - 'auth': [], - 'endpoint_path': '/v1/admin/disclaimer/list', - 'operation_id': 'v1_admin_disclaimer_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - def v1_admin_disclaimer_did_get( + + @validate_call + async def v1_admin_disclaimer_did_get( self, - session_token, - did, - **kwargs - ): - """Get a disclaimer by disclaimer id # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_disclaimer_did_get(session_token, did, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - did (str): The ID of the entity - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Disclaimer - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + did: Annotated[StrictStr, Field(description="The ID of the entity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Disclaimer: + """Get a disclaimer by disclaimer id + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param did: The ID of the entity (required) + :type did: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_disclaimer_did_get_serialize( + session_token=session_token, + did=did, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Disclaimer", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_disclaimer_did_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + did: Annotated[StrictStr, Field(description="The ID of the entity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Disclaimer]: + """Get a disclaimer by disclaimer id + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param did: The ID of the entity (required) + :type did: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_disclaimer_did_get_serialize( + session_token=session_token, + did=did, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Disclaimer", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_admin_disclaimer_did_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + did: Annotated[StrictStr, Field(description="The ID of the entity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a disclaimer by disclaimer id + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param did: The ID of the entity (required) + :type did: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_disclaimer_did_get_serialize( + session_token=session_token, + did=did, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Disclaimer", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['did'] = \ - did - return self.v1_admin_disclaimer_did_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_disclaimer_did_users_get( + return response_data.response + + + def _v1_admin_disclaimer_did_get_serialize( self, session_token, did, - **kwargs - ): - """List all users assigned to this disclaimer # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_disclaimer_did_users_get(session_token, did, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - did (str): The ID of the entity - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserIdList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if did is not None: + _path_params['did'] = did + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/disclaimer/{did}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def v1_admin_disclaimer_did_users_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + did: Annotated[StrictStr, Field(description="The ID of the entity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[int]: + """List all users assigned to this disclaimer + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param did: The ID of the entity (required) + :type did: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_disclaimer_did_users_get_serialize( + session_token=session_token, + did=did, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[int]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_disclaimer_did_users_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + did: Annotated[StrictStr, Field(description="The ID of the entity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[int]]: + """List all users assigned to this disclaimer + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param did: The ID of the entity (required) + :type did: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_disclaimer_did_users_get_serialize( + session_token=session_token, + did=did, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[int]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_admin_disclaimer_did_users_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + did: Annotated[StrictStr, Field(description="The ID of the entity")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all users assigned to this disclaimer + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param did: The ID of the entity (required) + :type did: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_disclaimer_did_users_get_serialize( + session_token=session_token, + did=did, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[int]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['did'] = \ - did - return self.v1_admin_disclaimer_did_users_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_disclaimer_list_get( + return response_data.response + + + def _v1_admin_disclaimer_did_users_get_serialize( self, session_token, - **kwargs - ): - """List all disclaimers for the company (pod) # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_disclaimer_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - DisclaimerList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + did, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if did is not None: + _path_params['did'] = did + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/disclaimer/{did}/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + + + + @validate_call + async def v1_admin_disclaimer_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[Disclaimer]: + """List all disclaimers for the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_disclaimer_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Disclaimer]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_disclaimer_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[Disclaimer]]: + """List all disclaimers for the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_disclaimer_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Disclaimer]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_admin_disclaimer_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all disclaimers for the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_disclaimer_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Disclaimer]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_admin_disclaimer_list_get_endpoint.call_with_http_info(**kwargs) + return response_data.response + + + def _v1_admin_disclaimer_list_get_serialize( + self, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/disclaimer/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/info_barriers_api.py b/symphony/bdk/gen/pod_api/info_barriers_api.py index 6ab3d6de..ee0b3c55 100644 --- a/symphony/bdk/gen/pod_api/info_barriers_api.py +++ b/symphony/bdk/gen/pod_api/info_barriers_api.py @@ -1,736 +1,1526 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) +from pydantic import Field, StrictInt, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.bulk_action_result import BulkActionResult -from symphony.bdk.gen.pod_model.error import Error -from symphony.bdk.gen.pod_model.group_list import GroupList -from symphony.bdk.gen.pod_model.integer_list import IntegerList -from symphony.bdk.gen.pod_model.policy_list import PolicyList +from symphony.bdk.gen.pod_model.group import Group +from symphony.bdk.gen.pod_model.policy import Policy + +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class InfoBarriersApi(object): +class InfoBarriersApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_admin_group_gid_membership_add_post_endpoint = _Endpoint( - settings={ - 'response_type': (BulkActionResult,), - 'auth': [], - 'endpoint_path': '/v1/admin/group/{gid}/membership/add', - 'operation_id': 'v1_admin_group_gid_membership_add_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'gid', - 'session_token', - 'users', - ], - 'required': [ - 'gid', - 'session_token', - 'users', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'gid': - (str,), - 'session_token': - (str,), - 'users': - (IntegerList,), - }, - 'attribute_map': { - 'gid': 'gid', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'gid': 'path', - 'session_token': 'header', - 'users': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_group_gid_membership_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (IntegerList,), - 'auth': [], - 'endpoint_path': '/v1/admin/group/{gid}/membership/list', - 'operation_id': 'v1_admin_group_gid_membership_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'gid', - 'session_token', - 'skip', - 'limit', - ], - 'required': [ - 'gid', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'gid': - (str,), - 'session_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'gid': 'gid', - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'gid': 'path', - 'session_token': 'header', - 'skip': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_group_gid_membership_remove_post_endpoint = _Endpoint( - settings={ - 'response_type': (BulkActionResult,), - 'auth': [], - 'endpoint_path': '/v1/admin/group/{gid}/membership/remove', - 'operation_id': 'v1_admin_group_gid_membership_remove_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'gid', - 'session_token', - 'users', - ], - 'required': [ - 'gid', - 'session_token', - 'users', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'gid': - (str,), - 'session_token': - (str,), - 'users': - (IntegerList,), - }, - 'attribute_map': { - 'gid': 'gid', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'gid': 'path', - 'session_token': 'header', - 'users': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_group_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (GroupList,), - 'auth': [], - 'endpoint_path': '/v1/admin/group/list', - 'operation_id': 'v1_admin_group_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_policy_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (PolicyList,), - 'auth': [], - 'endpoint_path': '/v1/admin/policy/list', - 'operation_id': 'v1_admin_policy_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + + + @validate_call + async def v1_admin_group_gid_membership_add_post( + self, + gid: Annotated[StrictStr, Field(description="URL-Safe encoded Group ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + users: List[StrictInt], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BulkActionResult: + """Add members to an Information Barrier group. + + + :param gid: URL-Safe encoded Group ID (required) + :type gid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param users: (required) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_gid_membership_add_post_serialize( + gid=gid, + session_token=session_token, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BulkActionResult", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + - def v1_admin_group_gid_membership_add_post( + @validate_call + async def v1_admin_group_gid_membership_add_post_with_http_info( + self, + gid: Annotated[StrictStr, Field(description="URL-Safe encoded Group ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + users: List[StrictInt], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BulkActionResult]: + """Add members to an Information Barrier group. + + + :param gid: URL-Safe encoded Group ID (required) + :type gid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param users: (required) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_gid_membership_add_post_serialize( + gid=gid, + session_token=session_token, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BulkActionResult", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_group_gid_membership_add_post_without_preload_content( + self, + gid: Annotated[StrictStr, Field(description="URL-Safe encoded Group ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + users: List[StrictInt], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add members to an Information Barrier group. + + + :param gid: URL-Safe encoded Group ID (required) + :type gid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param users: (required) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_gid_membership_add_post_serialize( + gid=gid, + session_token=session_token, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BulkActionResult", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_group_gid_membership_add_post_serialize( self, gid, session_token, users, - **kwargs - ): - """Add members to an Information Barrier group. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_group_gid_membership_add_post(gid, session_token, users, async_req=True) - >>> result = thread.get() - - Args: - gid (str): URL-Safe encoded Group ID - session_token (str): Session authentication token. - users (IntegerList): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - BulkActionResult - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['gid'] = \ - gid - kwargs['session_token'] = \ - session_token - kwargs['users'] = \ - users - return self.v1_admin_group_gid_membership_add_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_group_gid_membership_list_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'users': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if gid is not None: + _path_params['gid'] = gid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if users is not None: + _body_params = users + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/group/{gid}/membership/add', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_group_gid_membership_list_get( + self, + gid: Annotated[StrictStr, Field(description="URL-Safe encoded Group ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of records to skip. Must be a positive integer.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max number of records to return. Default is 10000. Must be a positive integer and must not exceed 10000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[int]: + """Get the list of userids in this Information Barrier Group + + + :param gid: URL-Safe encoded Group ID (required) + :type gid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of records to skip. Must be a positive integer. + :type skip: int + :param limit: Max number of records to return. Default is 10000. Must be a positive integer and must not exceed 10000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_gid_membership_list_get_serialize( + gid=gid, + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[int]", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_group_gid_membership_list_get_with_http_info( + self, + gid: Annotated[StrictStr, Field(description="URL-Safe encoded Group ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of records to skip. Must be a positive integer.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max number of records to return. Default is 10000. Must be a positive integer and must not exceed 10000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[int]]: + """Get the list of userids in this Information Barrier Group + + + :param gid: URL-Safe encoded Group ID (required) + :type gid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of records to skip. Must be a positive integer. + :type skip: int + :param limit: Max number of records to return. Default is 10000. Must be a positive integer and must not exceed 10000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_gid_membership_list_get_serialize( + gid=gid, + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[int]", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_group_gid_membership_list_get_without_preload_content( + self, + gid: Annotated[StrictStr, Field(description="URL-Safe encoded Group ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of records to skip. Must be a positive integer.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max number of records to return. Default is 10000. Must be a positive integer and must not exceed 10000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the list of userids in this Information Barrier Group + + + :param gid: URL-Safe encoded Group ID (required) + :type gid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of records to skip. Must be a positive integer. + :type skip: int + :param limit: Max number of records to return. Default is 10000. Must be a positive integer and must not exceed 10000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_gid_membership_list_get_serialize( + gid=gid, + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[int]", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_group_gid_membership_list_get_serialize( self, gid, session_token, - **kwargs - ): - """Get the list of userids in this Information Barrier Group # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_group_gid_membership_list_get(gid, session_token, async_req=True) - >>> result = thread.get() - - Args: - gid (str): URL-Safe encoded Group ID - session_token (str): Session authentication token. - - Keyword Args: - skip (int): Number of records to skip. Must be a positive integer.. [optional] - limit (int): Max number of records to return. Default is 10000. Must be a positive integer and must not exceed 10000.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - IntegerList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['gid'] = \ - gid - kwargs['session_token'] = \ - session_token - return self.v1_admin_group_gid_membership_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_group_gid_membership_remove_post( + skip, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if gid is not None: + _path_params['gid'] = gid + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/group/{gid}/membership/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_group_gid_membership_remove_post( + self, + gid: Annotated[StrictStr, Field(description="URL-Safe encoded Group ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + users: List[StrictInt], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> BulkActionResult: + """Remove members from an Information Barrier group + + + :param gid: URL-Safe encoded Group ID (required) + :type gid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param users: (required) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_gid_membership_remove_post_serialize( + gid=gid, + session_token=session_token, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BulkActionResult", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_group_gid_membership_remove_post_with_http_info( + self, + gid: Annotated[StrictStr, Field(description="URL-Safe encoded Group ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + users: List[StrictInt], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[BulkActionResult]: + """Remove members from an Information Barrier group + + + :param gid: URL-Safe encoded Group ID (required) + :type gid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param users: (required) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_gid_membership_remove_post_serialize( + gid=gid, + session_token=session_token, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BulkActionResult", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_group_gid_membership_remove_post_without_preload_content( + self, + gid: Annotated[StrictStr, Field(description="URL-Safe encoded Group ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + users: List[StrictInt], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remove members from an Information Barrier group + + + :param gid: URL-Safe encoded Group ID (required) + :type gid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param users: (required) + :type users: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_gid_membership_remove_post_serialize( + gid=gid, + session_token=session_token, + users=users, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BulkActionResult", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_group_gid_membership_remove_post_serialize( self, gid, session_token, users, - **kwargs - ): - """Remove members from an Information Barrier group # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_group_gid_membership_remove_post(gid, session_token, users, async_req=True) - >>> result = thread.get() - - Args: - gid (str): URL-Safe encoded Group ID - session_token (str): Session authentication token. - users (IntegerList): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - BulkActionResult - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['gid'] = \ - gid - kwargs['session_token'] = \ - session_token - kwargs['users'] = \ - users - return self.v1_admin_group_gid_membership_remove_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_group_list_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'users': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if gid is not None: + _path_params['gid'] = gid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if users is not None: + _body_params = users + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/group/{gid}/membership/remove', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_group_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[Group]: + """Get a list of all Information Barrier Groups + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Group]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_group_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[Group]]: + """Get a list of all Information Barrier Groups + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Group]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_group_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a list of all Information Barrier Groups + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_group_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Group]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_group_list_get_serialize( self, session_token, - **kwargs - ): - """Get a list of all Information Barrier Groups # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_group_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - GroupList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_admin_group_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_policy_list_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/group/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_policy_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[Policy]: + """Get all Information Policies + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_policy_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Policy]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_policy_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[Policy]]: + """Get all Information Policies + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_policy_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Policy]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_policy_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get all Information Policies + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_policy_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Policy]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_policy_list_get_serialize( self, session_token, - **kwargs - ): - """Get all Information Policies # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_policy_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - PolicyList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_admin_policy_list_get_endpoint.call_with_http_info(**kwargs) + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/policy/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/message_api.py b/symphony/bdk/gen/pod_api/message_api.py index 4282ec56..43849bd9 100644 --- a/symphony/bdk/gen/pod_api/message_api.py +++ b/symphony/bdk/gen/pod_api/message_api.py @@ -1,175 +1,325 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error +from pydantic import Field, StrictStr +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.message_status import MessageStatus +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class MessageApi(object): +class MessageApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_message_mid_status_get_endpoint = _Endpoint( - settings={ - 'response_type': (MessageStatus,), - 'auth': [], - 'endpoint_path': '/v1/message/{mid}/status', - 'operation_id': 'v1_message_mid_status_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'mid', - 'session_token', - ], - 'required': [ - 'mid', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'mid': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'mid': 'mid', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'mid': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - def v1_message_mid_status_get( + + @validate_call + async def v1_message_mid_status_get( self, - mid, - session_token, - **kwargs - ): - """Get the read status of a particular message. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_message_mid_status_get(mid, session_token, async_req=True) - >>> result = thread.get() - - Args: - mid (str): Message ID - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - MessageStatus - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + mid: Annotated[StrictStr, Field(description="Message ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MessageStatus: + """Get the read status of a particular message. + + + :param mid: Message ID (required) + :type mid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_mid_status_get_serialize( + mid=mid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageStatus", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_message_mid_status_get_with_http_info( + self, + mid: Annotated[StrictStr, Field(description="Message ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MessageStatus]: + """Get the read status of a particular message. + + + :param mid: Message ID (required) + :type mid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_mid_status_get_serialize( + mid=mid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageStatus", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_message_mid_status_get_without_preload_content( + self, + mid: Annotated[StrictStr, Field(description="Message ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the read status of a particular message. + + + :param mid: Message ID (required) + :type mid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_message_mid_status_get_serialize( + mid=mid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageStatus", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['mid'] = \ - mid - kwargs['session_token'] = \ - session_token - return self.v1_message_mid_status_get_endpoint.call_with_http_info(**kwargs) + return response_data.response + + + def _v1_message_mid_status_get_serialize( + self, + mid, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if mid is not None: + _path_params['mid'] = mid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/message/{mid}/status', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/message_suppression_api.py b/symphony/bdk/gen/pod_api/message_suppression_api.py index 990c6a72..8faf3beb 100644 --- a/symphony/bdk/gen/pod_api/message_suppression_api.py +++ b/symphony/bdk/gen/pod_api/message_suppression_api.py @@ -1,175 +1,322 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error +from pydantic import Field, StrictStr +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.message_suppression_response import MessageSuppressionResponse +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class MessageSuppressionApi(object): +class MessageSuppressionApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_admin_messagesuppression_id_suppress_post_endpoint = _Endpoint( - settings={ - 'response_type': (MessageSuppressionResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/messagesuppression/{id}/suppress', - 'operation_id': 'v1_admin_messagesuppression_id_suppress_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - ], - 'required': [ - 'id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - def v1_admin_messagesuppression_id_suppress_post( + + @validate_call + async def v1_admin_messagesuppression_id_suppress_post( self, - id, - session_token, - **kwargs - ): - """Suppress a message # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_messagesuppression_id_suppress_post(id, session_token, async_req=True) - >>> result = thread.get() - - Args: - id (str): URL-Safe encoded Message ID - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - MessageSuppressionResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + id: Annotated[StrictStr, Field(description="URL-Safe encoded Message ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> MessageSuppressionResponse: + """Suppress a message + + + :param id: URL-Safe encoded Message ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messagesuppression_id_suppress_post_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageSuppressionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_messagesuppression_id_suppress_post_with_http_info( + self, + id: Annotated[StrictStr, Field(description="URL-Safe encoded Message ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[MessageSuppressionResponse]: + """Suppress a message + + + :param id: URL-Safe encoded Message ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messagesuppression_id_suppress_post_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageSuppressionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_admin_messagesuppression_id_suppress_post_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="URL-Safe encoded Message ID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Suppress a message + + + :param id: URL-Safe encoded Message ID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_messagesuppression_id_suppress_post_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + + _response_types_map: Dict[str, Optional[str]] = { + '200': "MessageSuppressionResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - return self.v1_admin_messagesuppression_id_suppress_post_endpoint.call_with_http_info(**kwargs) + return response_data.response + + + def _v1_admin_messagesuppression_id_suppress_post_serialize( + self, + id, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/messagesuppression/{id}/suppress', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/pod_api.py b/symphony/bdk/gen/pod_api/pod_api.py index ba9af153..834ba470 100644 --- a/symphony/bdk/gen/pod_api/pod_api.py +++ b/symphony/bdk/gen/pod_api/pod_api.py @@ -1,395 +1,799 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error +from pydantic import Field, StrictStr +from typing import List +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.languages import Languages from symphony.bdk.gen.pod_model.pod_certificate import PodCertificate -from symphony.bdk.gen.pod_model.string_list import StringList +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class PodApi(object): + +class PodApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_files_allowed_types_get_endpoint = _Endpoint( - settings={ - 'response_type': (StringList,), - 'auth': [], - 'endpoint_path': '/v1/files/allowedTypes', - 'operation_id': 'v1_files_allowed_types_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_languages_get_endpoint = _Endpoint( - settings={ - 'response_type': (Languages,), - 'auth': [], - 'endpoint_path': '/v1/languages', - 'operation_id': 'v1_languages_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - }, - 'attribute_map': { - }, - 'location_map': { - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + + + @validate_call + async def v1_files_allowed_types_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[str]: + """Get supported attachment types for the pod + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_files_allowed_types_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - self.v1_podcert_get_endpoint = _Endpoint( - settings={ - 'response_type': (PodCertificate,), - 'auth': [], - 'endpoint_path': '/v1/podcert', - 'operation_id': 'v1_podcert_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - ], - 'required': [], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - }, - 'attribute_map': { - }, - 'location_map': { - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + - def v1_files_allowed_types_get( + @validate_call + async def v1_files_allowed_types_get_with_http_info( self, - session_token, - **kwargs - ): - """Get supported attachment types for the pod # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_files_allowed_types_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - StringList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[str]]: + """Get supported attachment types for the pod + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_files_allowed_types_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + + + @validate_call + async def v1_files_allowed_types_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get supported attachment types for the pod + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_files_allowed_types_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + return response_data.response + + + def _v1_files_allowed_types_get_serialize( + self, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/files/allowedTypes', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_files_allowed_types_get_endpoint.call_with_http_info(**kwargs) - - def v1_languages_get( + + + + + @validate_call + async def v1_languages_get( self, - **kwargs - ): - """Lists available languages for the pod. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_languages_get(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Languages - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Languages: + """Lists available languages for the pod. + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_languages_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Languages", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_languages_get_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Languages]: + """Lists available languages for the pod. + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_languages_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Languages", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + + + @validate_call + async def v1_languages_get_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Lists available languages for the pod. + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_languages_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Languages", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + return response_data.response + + + def _v1_languages_get_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/languages', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.v1_languages_get_endpoint.call_with_http_info(**kwargs) - def v1_podcert_get( + + + + @validate_call + async def v1_podcert_get( self, - **kwargs - ): - """Retrieve the pod certificate that can be use to validate signed JWT tokens generated from the pod # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_podcert_get(async_req=True) - >>> result = thread.get() - - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - PodCertificate - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PodCertificate: + """Retrieve the pod certificate that can be use to validate signed JWT tokens generated from the pod + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_podcert_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PodCertificate", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_podcert_get_with_http_info( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PodCertificate]: + """Retrieve the pod certificate that can be use to validate signed JWT tokens generated from the pod + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_podcert_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PodCertificate", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v1_podcert_get_without_preload_content( + self, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve the pod certificate that can be use to validate signed JWT tokens generated from the pod + + + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_podcert_get_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PodCertificate", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + return response_data.response + + + def _v1_podcert_get_serialize( + self, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/podcert', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - return self.v1_podcert_get_endpoint.call_with_http_info(**kwargs) + diff --git a/symphony/bdk/gen/pod_api/presence_api.py b/symphony/bdk/gen/pod_api/presence_api.py index abbb796a..47d77eb7 100644 --- a/symphony/bdk/gen/pod_api/presence_api.py +++ b/symphony/bdk/gen/pod_api/presence_api.py @@ -1,1274 +1,2681 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error +from pydantic import Field, StrictBool, StrictInt, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.string_id import StringId from symphony.bdk.gen.pod_model.success_response import SuccessResponse -from symphony.bdk.gen.pod_model.user_id_list import UserIdList from symphony.bdk.gen.pod_model.v2_presence import V2Presence -from symphony.bdk.gen.pod_model.v2_presence_list import V2PresenceList from symphony.bdk.gen.pod_model.v2_presence_status import V2PresenceStatus from symphony.bdk.gen.pod_model.v2_user_presence import V2UserPresence +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class PresenceApi(object): + +class PresenceApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_presence_feed_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (StringId,), - 'auth': [], - 'endpoint_path': '/v1/presence/feed/create', - 'operation_id': 'v1_presence_feed_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_presence_feed_feed_id_delete_post_endpoint = _Endpoint( - settings={ - 'response_type': (StringId,), - 'auth': [], - 'endpoint_path': '/v1/presence/feed/{feedId}/delete', - 'operation_id': 'v1_presence_feed_feed_id_delete_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'feed_id', - ], - 'required': [ - 'session_token', - 'feed_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'feed_id': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'feed_id': 'feedId', - }, - 'location_map': { - 'session_token': 'header', - 'feed_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_presence_feed_feed_id_read_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2PresenceList,), - 'auth': [], - 'endpoint_path': '/v1/presence/feed/{feedId}/read', - 'operation_id': 'v1_presence_feed_feed_id_read_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'feed_id', - ], - 'required': [ - 'session_token', - 'feed_id', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'feed_id': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'feed_id': 'feedId', - }, - 'location_map': { - 'session_token': 'header', - 'feed_id': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_user_presence_register_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/user/presence/register', - 'operation_id': 'v1_user_presence_register_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid_list', - ], - 'required': [ - 'session_token', - 'uid_list', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid_list': - (UserIdList,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'uid_list': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v2_user_presence_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2Presence,), - 'auth': [], - 'endpoint_path': '/v2/user/presence', - 'operation_id': 'v2_user_presence_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v2_user_presence_post_endpoint = _Endpoint( - settings={ - 'response_type': (V2Presence,), - 'auth': [], - 'endpoint_path': '/v2/user/presence', - 'operation_id': 'v2_user_presence_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'presence', - 'soft', - ], - 'required': [ - 'session_token', - 'presence', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'presence': - (V2PresenceStatus,), - 'soft': - (bool,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'soft': 'soft', - }, - 'location_map': { - 'session_token': 'header', - 'presence': 'body', - 'soft': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v2_users_presence_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2PresenceList,), - 'auth': [], - 'endpoint_path': '/v2/users/presence', - 'operation_id': 'v2_users_presence_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'last_user_id', - 'limit', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'last_user_id': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'last_user_id': 'lastUserId', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'last_user_id': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_user_presence_post_endpoint = _Endpoint( - settings={ - 'response_type': (V2Presence,), - 'auth': [], - 'endpoint_path': '/v3/user/presence', - 'operation_id': 'v3_user_presence_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'presence', - 'soft', - ], - 'required': [ - 'session_token', - 'presence', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'presence': - (V2UserPresence,), - 'soft': - (bool,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'soft': 'soft', - }, - 'location_map': { - 'session_token': 'header', - 'presence': 'body', - 'soft': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + + + @validate_call + async def v1_presence_feed_create_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> StringId: + """Create Presence status feed. + + Create a new stream capturing presence status changes (\"presence feed\"). When read from, the feed will return the current presence status of company (pod) users if it has changed since the last read. Returns the ID of the presence feed to be used in subsequent read operations. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_presence_feed_create_post_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StringId", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_presence_feed_create_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[StringId]: + """Create Presence status feed. + + Create a new stream capturing presence status changes (\"presence feed\"). When read from, the feed will return the current presence status of company (pod) users if it has changed since the last read. Returns the ID of the presence feed to be used in subsequent read operations. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_presence_feed_create_post_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StringId", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_presence_feed_create_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Presence status feed. + + Create a new stream capturing presence status changes (\"presence feed\"). When read from, the feed will return the current presence status of company (pod) users if it has changed since the last read. Returns the ID of the presence feed to be used in subsequent read operations. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_presence_feed_create_post_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StringId", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_presence_feed_create_post_serialize( + self, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_user_uid_presence_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2Presence,), - 'auth': [], - 'endpoint_path': '/v3/user/{uid}/presence', - 'operation_id': 'v3_user_uid_presence_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'uid', - 'session_token', - 'local', - ], - 'required': [ - 'uid', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'uid': - (int,), - 'session_token': - (str,), - 'local': - (bool,), - }, - 'attribute_map': { - 'uid': 'uid', - 'session_token': 'sessionToken', - 'local': 'local', - }, - 'location_map': { - 'uid': 'path', - 'session_token': 'header', - 'local': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/presence/feed/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def v1_presence_feed_create_post( + + + + @validate_call + async def v1_presence_feed_feed_id_delete_post( self, - session_token, - **kwargs - ): - """Create Presence status feed. # noqa: E501 - - Create a new stream capturing presence status changes (\"presence feed\"). When read from, the feed will return the current presence status of company (pod) users if it has changed since the last read. Returns the ID of the presence feed to be used in subsequent read operations. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_presence_feed_create_post(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - StringId - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_presence_feed_create_post_endpoint.call_with_http_info(**kwargs) - - def v1_presence_feed_feed_id_delete_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + feed_id: Annotated[StrictStr, Field(description="Presence feed ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> StringId: + """Delete a presence status feed. + + Returns the ID of the deleted feed. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param feed_id: Presence feed ID. (required) + :type feed_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_presence_feed_feed_id_delete_post_serialize( + session_token=session_token, + feed_id=feed_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StringId", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_presence_feed_feed_id_delete_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + feed_id: Annotated[StrictStr, Field(description="Presence feed ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[StringId]: + """Delete a presence status feed. + + Returns the ID of the deleted feed. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param feed_id: Presence feed ID. (required) + :type feed_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_presence_feed_feed_id_delete_post_serialize( + session_token=session_token, + feed_id=feed_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StringId", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_presence_feed_feed_id_delete_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + feed_id: Annotated[StrictStr, Field(description="Presence feed ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a presence status feed. + + Returns the ID of the deleted feed. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param feed_id: Presence feed ID. (required) + :type feed_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_presence_feed_feed_id_delete_post_serialize( + session_token=session_token, + feed_id=feed_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "StringId", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_presence_feed_feed_id_delete_post_serialize( self, session_token, feed_id, - **kwargs - ): - """Delete a presence status feed. # noqa: E501 - - Returns the ID of the deleted feed. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_presence_feed_feed_id_delete_post(session_token, feed_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - feed_id (str): Presence feed ID. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - StringId - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['feed_id'] = \ - feed_id - return self.v1_presence_feed_feed_id_delete_post_endpoint.call_with_http_info(**kwargs) - - def v1_presence_feed_feed_id_read_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if feed_id is not None: + _path_params['feedId'] = feed_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/presence/feed/{feedId}/delete', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_presence_feed_feed_id_read_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + feed_id: Annotated[StrictStr, Field(description="Presence feed ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V2Presence]: + """Read a presence status feed. + + Returns the current presence status of company (pod) users if it has changed since the last read. Returns up to 500 records at a time. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param feed_id: Presence feed ID. (required) + :type feed_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_presence_feed_feed_id_read_get_serialize( + session_token=session_token, + feed_id=feed_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2Presence]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_presence_feed_feed_id_read_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + feed_id: Annotated[StrictStr, Field(description="Presence feed ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V2Presence]]: + """Read a presence status feed. + + Returns the current presence status of company (pod) users if it has changed since the last read. Returns up to 500 records at a time. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param feed_id: Presence feed ID. (required) + :type feed_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_presence_feed_feed_id_read_get_serialize( + session_token=session_token, + feed_id=feed_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2Presence]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_presence_feed_feed_id_read_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + feed_id: Annotated[StrictStr, Field(description="Presence feed ID.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Read a presence status feed. + + Returns the current presence status of company (pod) users if it has changed since the last read. Returns up to 500 records at a time. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param feed_id: Presence feed ID. (required) + :type feed_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_presence_feed_feed_id_read_get_serialize( + session_token=session_token, + feed_id=feed_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2Presence]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_presence_feed_feed_id_read_get_serialize( self, session_token, feed_id, - **kwargs - ): - """Read a presence status feed. # noqa: E501 - - Returns the current presence status of company (pod) users if it has changed since the last read. Returns up to 500 records at a time. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_presence_feed_feed_id_read_get(session_token, feed_id, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - feed_id (str): Presence feed ID. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2PresenceList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['feed_id'] = \ - feed_id - return self.v1_presence_feed_feed_id_read_get_endpoint.call_with_http_info(**kwargs) - - def v1_user_presence_register_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if feed_id is not None: + _path_params['feedId'] = feed_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/presence/feed/{feedId}/read', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_user_presence_register_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid_list: Annotated[List[StrictInt], Field(description="List of (integer) User IDs of users whose presence to query")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Register interest in a user's presence status + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid_list: List of (integer) User IDs of users whose presence to query (required) + :type uid_list: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_presence_register_post_serialize( + session_token=session_token, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_user_presence_register_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid_list: Annotated[List[StrictInt], Field(description="List of (integer) User IDs of users whose presence to query")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Register interest in a user's presence status + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid_list: List of (integer) User IDs of users whose presence to query (required) + :type uid_list: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_presence_register_post_serialize( + session_token=session_token, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_user_presence_register_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid_list: Annotated[List[StrictInt], Field(description="List of (integer) User IDs of users whose presence to query")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Register interest in a user's presence status + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid_list: List of (integer) User IDs of users whose presence to query (required) + :type uid_list: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_presence_register_post_serialize( + session_token=session_token, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_user_presence_register_post_serialize( self, session_token, uid_list, - **kwargs - ): - """Register interest in a user's presence status # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_user_presence_register_post(session_token, uid_list, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid_list (UserIdList): List of (integer) User IDs of users whose presence to query - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid_list'] = \ - uid_list - return self.v1_user_presence_register_post_endpoint.call_with_http_info(**kwargs) - - def v2_user_presence_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'uidList': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if uid_list is not None: + _body_params = uid_list + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/user/presence/register', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_user_presence_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2Presence: + """Get presence information about the requesting user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_user_presence_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_user_presence_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2Presence]: + """Get presence information about the requesting user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_user_presence_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_user_presence_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get presence information about the requesting user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_user_presence_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_user_presence_get_serialize( self, session_token, - **kwargs - ): - """Get presence information about the requesting user. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_user_presence_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2Presence - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v2_user_presence_get_endpoint.call_with_http_info(**kwargs) - - def v2_user_presence_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/user/presence', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_user_presence_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + presence: V2PresenceStatus, + soft: Annotated[Optional[StrictBool], Field(description="If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2Presence: + """Set the presence of the requesting user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param presence: (required) + :type presence: V2PresenceStatus + :param soft: If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) + :type soft: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_user_presence_post_serialize( + session_token=session_token, + presence=presence, + soft=soft, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_user_presence_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + presence: V2PresenceStatus, + soft: Annotated[Optional[StrictBool], Field(description="If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2Presence]: + """Set the presence of the requesting user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param presence: (required) + :type presence: V2PresenceStatus + :param soft: If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) + :type soft: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_user_presence_post_serialize( + session_token=session_token, + presence=presence, + soft=soft, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_user_presence_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + presence: V2PresenceStatus, + soft: Annotated[Optional[StrictBool], Field(description="If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set the presence of the requesting user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param presence: (required) + :type presence: V2PresenceStatus + :param soft: If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) + :type soft: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_user_presence_post_serialize( + session_token=session_token, + presence=presence, + soft=soft, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_user_presence_post_serialize( self, session_token, presence, - **kwargs - ): - """Set the presence of the requesting user. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_user_presence_post(session_token, presence, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - presence (V2PresenceStatus): - - Keyword Args: - soft (bool): If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2Presence - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['presence'] = \ - presence - return self.v2_user_presence_post_endpoint.call_with_http_info(**kwargs) - - def v2_users_presence_get( + soft, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if soft is not None: + + _query_params.append(('soft', soft)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if presence is not None: + _body_params = presence + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v2/user/presence', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_users_presence_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + last_user_id: Annotated[Optional[StrictInt], Field(description="Last user ID retrieved. Used for paging; if provided, results will skip users with IDs less than this parameter.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max number of records to return. If no value is provided, 1000 is the default. The maximum supported value is 5000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V2Presence]: + """Get presence information about all company (pod) users. + + The returned data is taken from the in-memory cache for performance reasons which means inactive users may be omitted from the response. All non-inactive users WILL be returned and some inactive users MAY be included. Any omitted user IS inactive. Returned records are sorted by user ID, ascending. This method is expensive. It pulls ALL records from the cache, sorts them and then only uses a subset. For large numbers of users, this can be very inefficient both due to sorting and due to the cache being distributed across many nodes. Addiionally, there is the potential to miss users if they become active after the page in which their user ID falls has already been read by the client. To avoid this situation, a presence feed should be created (and optionally read from) first to capture presence changes of users who get reactivated during a paged call to this endpoint. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param last_user_id: Last user ID retrieved. Used for paging; if provided, results will skip users with IDs less than this parameter. + :type last_user_id: int + :param limit: Max number of records to return. If no value is provided, 1000 is the default. The maximum supported value is 5000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_users_presence_get_serialize( + session_token=session_token, + last_user_id=last_user_id, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2Presence]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_users_presence_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + last_user_id: Annotated[Optional[StrictInt], Field(description="Last user ID retrieved. Used for paging; if provided, results will skip users with IDs less than this parameter.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max number of records to return. If no value is provided, 1000 is the default. The maximum supported value is 5000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V2Presence]]: + """Get presence information about all company (pod) users. + + The returned data is taken from the in-memory cache for performance reasons which means inactive users may be omitted from the response. All non-inactive users WILL be returned and some inactive users MAY be included. Any omitted user IS inactive. Returned records are sorted by user ID, ascending. This method is expensive. It pulls ALL records from the cache, sorts them and then only uses a subset. For large numbers of users, this can be very inefficient both due to sorting and due to the cache being distributed across many nodes. Addiionally, there is the potential to miss users if they become active after the page in which their user ID falls has already been read by the client. To avoid this situation, a presence feed should be created (and optionally read from) first to capture presence changes of users who get reactivated during a paged call to this endpoint. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param last_user_id: Last user ID retrieved. Used for paging; if provided, results will skip users with IDs less than this parameter. + :type last_user_id: int + :param limit: Max number of records to return. If no value is provided, 1000 is the default. The maximum supported value is 5000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_users_presence_get_serialize( + session_token=session_token, + last_user_id=last_user_id, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2Presence]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_users_presence_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + last_user_id: Annotated[Optional[StrictInt], Field(description="Last user ID retrieved. Used for paging; if provided, results will skip users with IDs less than this parameter.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max number of records to return. If no value is provided, 1000 is the default. The maximum supported value is 5000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get presence information about all company (pod) users. + + The returned data is taken from the in-memory cache for performance reasons which means inactive users may be omitted from the response. All non-inactive users WILL be returned and some inactive users MAY be included. Any omitted user IS inactive. Returned records are sorted by user ID, ascending. This method is expensive. It pulls ALL records from the cache, sorts them and then only uses a subset. For large numbers of users, this can be very inefficient both due to sorting and due to the cache being distributed across many nodes. Addiionally, there is the potential to miss users if they become active after the page in which their user ID falls has already been read by the client. To avoid this situation, a presence feed should be created (and optionally read from) first to capture presence changes of users who get reactivated during a paged call to this endpoint. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param last_user_id: Last user ID retrieved. Used for paging; if provided, results will skip users with IDs less than this parameter. + :type last_user_id: int + :param limit: Max number of records to return. If no value is provided, 1000 is the default. The maximum supported value is 5000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_users_presence_get_serialize( + session_token=session_token, + last_user_id=last_user_id, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2Presence]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_users_presence_get_serialize( self, session_token, - **kwargs - ): - """Get presence information about all company (pod) users. # noqa: E501 - - The returned data is taken from the in-memory cache for performance reasons which means inactive users may be omitted from the response. All non-inactive users WILL be returned and some inactive users MAY be included. Any omitted user IS inactive. Returned records are sorted by user ID, ascending. This method is expensive. It pulls ALL records from the cache, sorts them and then only uses a subset. For large numbers of users, this can be very inefficient both due to sorting and due to the cache being distributed across many nodes. Addiionally, there is the potential to miss users if they become active after the page in which their user ID falls has already been read by the client. To avoid this situation, a presence feed should be created (and optionally read from) first to capture presence changes of users who get reactivated during a paged call to this endpoint. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_users_presence_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - last_user_id (int): Last user ID retrieved. Used for paging; if provided, results will skip users with IDs less than this parameter.. [optional] - limit (int): Max number of records to return. If no value is provided, 1000 is the default. The maximum supported value is 5000.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2PresenceList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v2_users_presence_get_endpoint.call_with_http_info(**kwargs) - - def v3_user_presence_post( + last_user_id, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if last_user_id is not None: + + _query_params.append(('lastUserId', last_user_id)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/users/presence', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_user_presence_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + presence: V2UserPresence, + soft: Annotated[Optional[StrictBool], Field(description="If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2Presence: + """Set presence information for a particular user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param presence: (required) + :type presence: V2UserPresence + :param soft: If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) + :type soft: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_user_presence_post_serialize( + session_token=session_token, + presence=presence, + soft=soft, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_user_presence_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + presence: V2UserPresence, + soft: Annotated[Optional[StrictBool], Field(description="If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2Presence]: + """Set presence information for a particular user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param presence: (required) + :type presence: V2UserPresence + :param soft: If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) + :type soft: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_user_presence_post_serialize( + session_token=session_token, + presence=presence, + soft=soft, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_user_presence_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + presence: V2UserPresence, + soft: Annotated[Optional[StrictBool], Field(description="If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Set presence information for a particular user. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param presence: (required) + :type presence: V2UserPresence + :param soft: If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) + :type soft: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_user_presence_post_serialize( + session_token=session_token, + presence=presence, + soft=soft, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_user_presence_post_serialize( self, session_token, presence, - **kwargs - ): - """Set presence information for a particular user. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v3_user_presence_post(session_token, presence, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - presence (V2UserPresence): - - Keyword Args: - soft (bool): If true, the user's current status is taken into consideration. If the user is currently OFFLINE, the user's presence will still be OFFLINE, but the new presence will take effect when the user comes online. If the user is currently online, the user's activity state will be applied to the presence if applicable. (e.g. if you are setting their presence to AVAILABLE, but the user is currently idle, their status will be represented as AWAY) . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2Presence - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['presence'] = \ - presence - return self.v3_user_presence_post_endpoint.call_with_http_info(**kwargs) - - def v3_user_uid_presence_get( + soft, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if soft is not None: + + _query_params.append(('soft', soft)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if presence is not None: + _body_params = presence + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/user/presence', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_user_uid_presence_get( + self, + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + local: Annotated[Optional[StrictBool], Field(description="If true, a local query will be performed and the presence will be set to OFFLINE for users who are not local to the calling user's pod. If false or absent, then the presence of all local users and the presence of all external users to whom the calling user is connected will be queried. For external users, a \"presence interest\" should be registered through /v1/user/presence/register before querying for presence. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2Presence: + """Get presence information about a particular user. + + + :param uid: User ID as a decimal integer (required) + :type uid: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param local: If true, a local query will be performed and the presence will be set to OFFLINE for users who are not local to the calling user's pod. If false or absent, then the presence of all local users and the presence of all external users to whom the calling user is connected will be queried. For external users, a \"presence interest\" should be registered through /v1/user/presence/register before querying for presence. + :type local: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_user_uid_presence_get_serialize( + uid=uid, + session_token=session_token, + local=local, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_user_uid_presence_get_with_http_info( + self, + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + local: Annotated[Optional[StrictBool], Field(description="If true, a local query will be performed and the presence will be set to OFFLINE for users who are not local to the calling user's pod. If false or absent, then the presence of all local users and the presence of all external users to whom the calling user is connected will be queried. For external users, a \"presence interest\" should be registered through /v1/user/presence/register before querying for presence. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2Presence]: + """Get presence information about a particular user. + + + :param uid: User ID as a decimal integer (required) + :type uid: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param local: If true, a local query will be performed and the presence will be set to OFFLINE for users who are not local to the calling user's pod. If false or absent, then the presence of all local users and the presence of all external users to whom the calling user is connected will be queried. For external users, a \"presence interest\" should be registered through /v1/user/presence/register before querying for presence. + :type local: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_user_uid_presence_get_serialize( + uid=uid, + session_token=session_token, + local=local, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_user_uid_presence_get_without_preload_content( + self, + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + local: Annotated[Optional[StrictBool], Field(description="If true, a local query will be performed and the presence will be set to OFFLINE for users who are not local to the calling user's pod. If false or absent, then the presence of all local users and the presence of all external users to whom the calling user is connected will be queried. For external users, a \"presence interest\" should be registered through /v1/user/presence/register before querying for presence. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get presence information about a particular user. + + + :param uid: User ID as a decimal integer (required) + :type uid: int + :param session_token: Session authentication token. (required) + :type session_token: str + :param local: If true, a local query will be performed and the presence will be set to OFFLINE for users who are not local to the calling user's pod. If false or absent, then the presence of all local users and the presence of all external users to whom the calling user is connected will be queried. For external users, a \"presence interest\" should be registered through /v1/user/presence/register before querying for presence. + :type local: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_user_uid_presence_get_serialize( + uid=uid, + session_token=session_token, + local=local, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2Presence", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_user_uid_presence_get_serialize( self, uid, session_token, - **kwargs - ): - """Get presence information about a particular user. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v3_user_uid_presence_get(uid, session_token, async_req=True) - >>> result = thread.get() - - Args: - uid (int): User ID as a decimal integer - session_token (str): Session authentication token. - - Keyword Args: - local (bool): If true, a local query will be performed and the presence will be set to OFFLINE for users who are not local to the calling user's pod. If false or absent, then the presence of all local users and the presence of all external users to whom the calling user is connected will be queried. For external users, a \"presence interest\" should be registered through /v1/user/presence/register before querying for presence. . [optional] if omitted the server will use the default value of False - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2Presence - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['uid'] = \ - uid - kwargs['session_token'] = \ - session_token - return self.v3_user_uid_presence_get_endpoint.call_with_http_info(**kwargs) + local, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + if local is not None: + + _query_params.append(('local', local)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/user/{uid}/presence', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/room_membership_api.py b/symphony/bdk/gen/pod_api/room_membership_api.py index daf2c3fb..1a066b59 100644 --- a/symphony/bdk/gen/pod_api/room_membership_api.py +++ b/symphony/bdk/gen/pod_api/room_membership_api.py @@ -1,1201 +1,2498 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error -from symphony.bdk.gen.pod_model.membership_list import MembershipList +from pydantic import Field, StrictBool, StrictStr +from typing import List, Optional +from typing_extensions import Annotated +from symphony.bdk.gen.pod_model.member_info import MemberInfo from symphony.bdk.gen.pod_model.success_response import SuccessResponse from symphony.bdk.gen.pod_model.user_id import UserId +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class RoomMembershipApi(object): +class RoomMembershipApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_admin_room_id_membership_add_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/room/{id}/membership/add', - 'operation_id': 'v1_admin_room_id_membership_add_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'payload', - ], - 'required': [ - 'id', - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'payload': - (UserId,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_room_id_membership_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (MembershipList,), - 'auth': [], - 'endpoint_path': '/v1/admin/room/{id}/membership/list', - 'operation_id': 'v1_admin_room_id_membership_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'include_past_members', - ], - 'required': [ - 'id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'include_past_members': - (bool,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - 'include_past_members': 'includePastMembers', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'include_past_members': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_room_id_membership_remove_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/room/{id}/membership/remove', - 'operation_id': 'v1_admin_room_id_membership_remove_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'payload', - ], - 'required': [ - 'id', - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'payload': - (UserId,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_room_id_membership_add_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/room/{id}/membership/add', - 'operation_id': 'v1_room_id_membership_add_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'payload', - ], - 'required': [ - 'id', - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'payload': - (UserId,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_room_id_membership_demote_owner_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/room/{id}/membership/demoteOwner', - 'operation_id': 'v1_room_id_membership_demote_owner_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'payload', - ], - 'required': [ - 'id', - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'payload': - (UserId,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_room_id_membership_promote_owner_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/room/{id}/membership/promoteOwner', - 'operation_id': 'v1_room_id_membership_promote_owner_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'payload', - ], - 'required': [ - 'id', - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'payload': - (UserId,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_room_id_membership_remove_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/room/{id}/membership/remove', - 'operation_id': 'v1_room_id_membership_remove_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'payload', - ], - 'required': [ - 'id', - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'payload': - (UserId,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v2_room_id_membership_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (MembershipList,), - 'auth': [], - 'endpoint_path': '/v2/room/{id}/membership/list', - 'operation_id': 'v2_room_id_membership_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - ], - 'required': [ - 'id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + + + @validate_call + async def v1_admin_room_id_membership_add_post( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Add a member to an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_membership_add_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_room_id_membership_add_post_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Add a member to an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_membership_add_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - def v1_admin_room_id_membership_add_post( + + @validate_call + async def v1_admin_room_id_membership_add_post_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add a member to an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_membership_add_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_room_id_membership_add_post_serialize( self, id, session_token, payload, - **kwargs - ): - """Add a member to an existing room. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_room_id_membership_add_post(id, session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - session_token (str): Session authentication token. - payload (UserId): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v1_admin_room_id_membership_add_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_room_id_membership_list_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/room/{id}/membership/add', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_room_id_membership_list_get( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + include_past_members: Annotated[Optional[StrictBool], Field(description="If true, the membership list will include past members of the stream. If false, the listing will only incude current members. Default false.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[MemberInfo]: + """Lists current and previous members of an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param include_past_members: If true, the membership list will include past members of the stream. If false, the listing will only incude current members. Default false. + :type include_past_members: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_membership_list_get_serialize( + id=id, + session_token=session_token, + include_past_members=include_past_members, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[MemberInfo]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_room_id_membership_list_get_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + include_past_members: Annotated[Optional[StrictBool], Field(description="If true, the membership list will include past members of the stream. If false, the listing will only incude current members. Default false.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[MemberInfo]]: + """Lists current and previous members of an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param include_past_members: If true, the membership list will include past members of the stream. If false, the listing will only incude current members. Default false. + :type include_past_members: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_membership_list_get_serialize( + id=id, + session_token=session_token, + include_past_members=include_past_members, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[MemberInfo]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_room_id_membership_list_get_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + include_past_members: Annotated[Optional[StrictBool], Field(description="If true, the membership list will include past members of the stream. If false, the listing will only incude current members. Default false.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Lists current and previous members of an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param include_past_members: If true, the membership list will include past members of the stream. If false, the listing will only incude current members. Default false. + :type include_past_members: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_membership_list_get_serialize( + id=id, + session_token=session_token, + include_past_members=include_past_members, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[MemberInfo]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_room_id_membership_list_get_serialize( self, id, session_token, - **kwargs - ): - """Lists current and previous members of an existing room. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_room_id_membership_list_get(id, session_token, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - session_token (str): Session authentication token. - - Keyword Args: - include_past_members (bool): If true, the membership list will include past members of the stream. If false, the listing will only incude current members. Default false.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - MembershipList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - return self.v1_admin_room_id_membership_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_room_id_membership_remove_post( + include_past_members, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if include_past_members is not None: + + _query_params.append(('includePastMembers', include_past_members)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/room/{id}/membership/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_room_id_membership_remove_post( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Remove a member from a room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_membership_remove_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_room_id_membership_remove_post_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Remove a member from a room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_membership_remove_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_room_id_membership_remove_post_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remove a member from a room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_membership_remove_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_room_id_membership_remove_post_serialize( self, id, session_token, payload, - **kwargs - ): - """Remove a member from a room. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_room_id_membership_remove_post(id, session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - session_token (str): Session authentication token. - payload (UserId): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v1_admin_room_id_membership_remove_post_endpoint.call_with_http_info(**kwargs) - - def v1_room_id_membership_add_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/room/{id}/membership/remove', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_room_id_membership_add_post( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Adds new member to an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_add_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_room_id_membership_add_post_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Adds new member to an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_add_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_room_id_membership_add_post_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Adds new member to an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_add_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_room_id_membership_add_post_serialize( self, id, session_token, payload, - **kwargs - ): - """Adds new member to an existing room. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_room_id_membership_add_post(id, session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - session_token (str): Session authentication token. - payload (UserId): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v1_room_id_membership_add_post_endpoint.call_with_http_info(**kwargs) - - def v1_room_id_membership_demote_owner_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/room/{id}/membership/add', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_room_id_membership_demote_owner_post( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Demotes room owner. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_demote_owner_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_room_id_membership_demote_owner_post_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Demotes room owner. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_demote_owner_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_room_id_membership_demote_owner_post_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Demotes room owner. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_demote_owner_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_room_id_membership_demote_owner_post_serialize( self, id, session_token, payload, - **kwargs - ): - """Demotes room owner. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_room_id_membership_demote_owner_post(id, session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - session_token (str): Session authentication token. - payload (UserId): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v1_room_id_membership_demote_owner_post_endpoint.call_with_http_info(**kwargs) - - def v1_room_id_membership_promote_owner_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/room/{id}/membership/demoteOwner', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_room_id_membership_promote_owner_post( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Promotes user to owner. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_promote_owner_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_room_id_membership_promote_owner_post_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Promotes user to owner. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_promote_owner_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_room_id_membership_promote_owner_post_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Promotes user to owner. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_promote_owner_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_room_id_membership_promote_owner_post_serialize( self, id, session_token, payload, - **kwargs - ): - """Promotes user to owner. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_room_id_membership_promote_owner_post(id, session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - session_token (str): Session authentication token. - payload (UserId): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v1_room_id_membership_promote_owner_post_endpoint.call_with_http_info(**kwargs) - - def v1_room_id_membership_remove_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/room/{id}/membership/promoteOwner', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_room_id_membership_remove_post( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Removes member from an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_remove_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_room_id_membership_remove_post_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Removes member from an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_remove_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_room_id_membership_remove_post_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Removes member from an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_membership_remove_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_room_id_membership_remove_post_serialize( self, id, session_token, payload, - **kwargs - ): - """Removes member from an existing room. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_room_id_membership_remove_post(id, session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - session_token (str): Session authentication token. - payload (UserId): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v1_room_id_membership_remove_post_endpoint.call_with_http_info(**kwargs) - - def v2_room_id_membership_list_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/room/{id}/membership/remove', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_room_id_membership_list_get( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[MemberInfo]: + """Lists current members of an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_room_id_membership_list_get_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[MemberInfo]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_room_id_membership_list_get_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[MemberInfo]]: + """Lists current members of an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_room_id_membership_list_get_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[MemberInfo]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_room_id_membership_list_get_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Lists current members of an existing room. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_room_id_membership_list_get_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[MemberInfo]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_room_id_membership_list_get_serialize( self, id, session_token, - **kwargs - ): - """Lists current members of an existing room. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_room_id_membership_list_get(id, session_token, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - MembershipList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - return self.v2_room_id_membership_list_get_endpoint.call_with_http_info(**kwargs) + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/room/{id}/membership/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/security_api.py b/symphony/bdk/gen/pod_api/security_api.py index 2ef4d7a2..c0ab6b3b 100644 --- a/symphony/bdk/gen/pod_api/security_api.py +++ b/symphony/bdk/gen/pod_api/security_api.py @@ -1,1163 +1,2457 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) +from pydantic import Field, StrictInt, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.company_cert import CompanyCert from symphony.bdk.gen.pod_model.company_cert_attributes import CompanyCertAttributes from symphony.bdk.gen.pod_model.company_cert_detail import CompanyCertDetail -from symphony.bdk.gen.pod_model.company_cert_info_list import CompanyCertInfoList -from symphony.bdk.gen.pod_model.company_cert_type_list import CompanyCertTypeList -from symphony.bdk.gen.pod_model.error import Error +from symphony.bdk.gen.pod_model.company_cert_info_list_inner import CompanyCertInfoListInner +from symphony.bdk.gen.pod_model.company_cert_type import CompanyCertType from symphony.bdk.gen.pod_model.string_id import StringId from symphony.bdk.gen.pod_model.success_response import SuccessResponse +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class SecurityApi(object): + +class SecurityApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_companycert_delete_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/companycert/delete', - 'operation_id': 'v1_companycert_delete_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'finger_print', - ], - 'required': [ - 'session_token', - 'finger_print', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'finger_print': - (StringId,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'finger_print': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_companycert_finger_print_get_get_endpoint = _Endpoint( - settings={ - 'response_type': (CompanyCertDetail,), - 'auth': [], - 'endpoint_path': '/v1/companycert/{fingerPrint}/get', - 'operation_id': 'v1_companycert_finger_print_get_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'finger_print', - 'session_token', - ], - 'required': [ - 'finger_print', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'finger_print': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'finger_print': 'fingerPrint', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'finger_print': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_companycert_finger_print_issued_by_get_endpoint = _Endpoint( - settings={ - 'response_type': (CompanyCertInfoList,), - 'auth': [], - 'endpoint_path': '/v1/companycert/{fingerPrint}/issuedBy', - 'operation_id': 'v1_companycert_finger_print_issued_by_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'finger_print', - 'session_token', - ], - 'required': [ - 'finger_print', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'finger_print': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'finger_print': 'fingerPrint', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'finger_print': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_companycert_finger_print_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/companycert/{fingerPrint}/update', - 'operation_id': 'v1_companycert_finger_print_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'finger_print', - 'session_token', - 'cert_attributes', - ], - 'required': [ - 'finger_print', - 'session_token', - 'cert_attributes', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'finger_print': - (str,), - 'session_token': - (str,), - 'cert_attributes': - (CompanyCertAttributes,), - }, - 'attribute_map': { - 'finger_print': 'fingerPrint', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'finger_print': 'path', - 'session_token': 'header', - 'cert_attributes': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_companycert_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (CompanyCertInfoList,), - 'auth': [], - 'endpoint_path': '/v1/companycert/list', - 'operation_id': 'v1_companycert_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'skip', - 'limit', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'skip': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_companycert_podmanaged_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (CompanyCertInfoList,), - 'auth': [], - 'endpoint_path': '/v1/companycert/podmanaged/list', - 'operation_id': 'v1_companycert_podmanaged_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'skip', - 'limit', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'skip': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_companycert_type_list_post_endpoint = _Endpoint( - settings={ - 'response_type': (CompanyCertInfoList,), - 'auth': [], - 'endpoint_path': '/v1/companycert/type/list', - 'operation_id': 'v1_companycert_type_list_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'type_id_list', - 'skip', - 'limit', - ], - 'required': [ - 'session_token', - 'type_id_list', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'type_id_list': - (CompanyCertTypeList,), - 'skip': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'type_id_list': 'body', - 'skip': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v2_companycert_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (CompanyCertDetail,), - 'auth': [], - 'endpoint_path': '/v2/companycert/create', - 'operation_id': 'v2_companycert_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'cert', - ], - 'required': [ - 'session_token', - 'cert', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'cert': - (CompanyCert,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'cert': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client + + + @validate_call + async def v1_companycert_delete_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + finger_print: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Delete a company certificate + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param finger_print: (required) + :type finger_print: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_delete_post_serialize( + session_token=session_token, + finger_print=finger_print, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - def v1_companycert_delete_post( + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_companycert_delete_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + finger_print: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Delete a company certificate + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param finger_print: (required) + :type finger_print: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_delete_post_serialize( + session_token=session_token, + finger_print=finger_print, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_companycert_delete_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + finger_print: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete a company certificate + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param finger_print: (required) + :type finger_print: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_delete_post_serialize( + session_token=session_token, + finger_print=finger_print, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_companycert_delete_post_serialize( self, session_token, finger_print, - **kwargs - ): - """Delete a company certificate # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_companycert_delete_post(session_token, finger_print, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - finger_print (StringId): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['finger_print'] = \ - finger_print - return self.v1_companycert_delete_post_endpoint.call_with_http_info(**kwargs) - - def v1_companycert_finger_print_get_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if finger_print is not None: + _body_params = finger_print + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/companycert/delete', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_companycert_finger_print_get_get( + self, + finger_print: Annotated[StrictStr, Field(description="Certificate fingerPrint (ID)")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CompanyCertDetail: + """Get the details of a company certificate + + + :param finger_print: Certificate fingerPrint (ID) (required) + :type finger_print: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_finger_print_get_get_serialize( + finger_print=finger_print, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CompanyCertDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_companycert_finger_print_get_get_with_http_info( + self, + finger_print: Annotated[StrictStr, Field(description="Certificate fingerPrint (ID)")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CompanyCertDetail]: + """Get the details of a company certificate + + + :param finger_print: Certificate fingerPrint (ID) (required) + :type finger_print: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_finger_print_get_get_serialize( + finger_print=finger_print, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CompanyCertDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_companycert_finger_print_get_get_without_preload_content( + self, + finger_print: Annotated[StrictStr, Field(description="Certificate fingerPrint (ID)")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the details of a company certificate + + + :param finger_print: Certificate fingerPrint (ID) (required) + :type finger_print: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_finger_print_get_get_serialize( + finger_print=finger_print, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CompanyCertDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_companycert_finger_print_get_get_serialize( self, finger_print, session_token, - **kwargs - ): - """Get the details of a company certificate # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_companycert_finger_print_get_get(finger_print, session_token, async_req=True) - >>> result = thread.get() - - Args: - finger_print (str): Certificate fingerPrint (ID) - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - CompanyCertDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['finger_print'] = \ - finger_print - kwargs['session_token'] = \ - session_token - return self.v1_companycert_finger_print_get_get_endpoint.call_with_http_info(**kwargs) - - def v1_companycert_finger_print_issued_by_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if finger_print is not None: + _path_params['fingerPrint'] = finger_print + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/companycert/{fingerPrint}/get', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_companycert_finger_print_issued_by_get( + self, + finger_print: Annotated[StrictStr, Field(description="Certificate fingerPrint (ID)")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[CompanyCertInfoListInner]: + """Return a list of all certificates which were verified to the cert whose fingerprint is passed. + + + :param finger_print: Certificate fingerPrint (ID) (required) + :type finger_print: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_finger_print_issued_by_get_serialize( + finger_print=finger_print, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_companycert_finger_print_issued_by_get_with_http_info( + self, + finger_print: Annotated[StrictStr, Field(description="Certificate fingerPrint (ID)")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[CompanyCertInfoListInner]]: + """Return a list of all certificates which were verified to the cert whose fingerprint is passed. + + + :param finger_print: Certificate fingerPrint (ID) (required) + :type finger_print: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_finger_print_issued_by_get_serialize( + finger_print=finger_print, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_companycert_finger_print_issued_by_get_without_preload_content( + self, + finger_print: Annotated[StrictStr, Field(description="Certificate fingerPrint (ID)")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Return a list of all certificates which were verified to the cert whose fingerprint is passed. + + + :param finger_print: Certificate fingerPrint (ID) (required) + :type finger_print: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_finger_print_issued_by_get_serialize( + finger_print=finger_print, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_companycert_finger_print_issued_by_get_serialize( self, finger_print, session_token, - **kwargs - ): - """Return a list of all certificates which were verified to the cert whose fingerprint is passed. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_companycert_finger_print_issued_by_get(finger_print, session_token, async_req=True) - >>> result = thread.get() - - Args: - finger_print (str): Certificate fingerPrint (ID) - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - CompanyCertInfoList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['finger_print'] = \ - finger_print - kwargs['session_token'] = \ - session_token - return self.v1_companycert_finger_print_issued_by_get_endpoint.call_with_http_info(**kwargs) - - def v1_companycert_finger_print_update_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if finger_print is not None: + _path_params['fingerPrint'] = finger_print + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/companycert/{fingerPrint}/issuedBy', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_companycert_finger_print_update_post( + self, + finger_print: Annotated[StrictStr, Field(description="Certificate fingerPrint (ID)")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + cert_attributes: CompanyCertAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Update a company certificate + + + :param finger_print: Certificate fingerPrint (ID) (required) + :type finger_print: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param cert_attributes: (required) + :type cert_attributes: CompanyCertAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_finger_print_update_post_serialize( + finger_print=finger_print, + session_token=session_token, + cert_attributes=cert_attributes, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_companycert_finger_print_update_post_with_http_info( + self, + finger_print: Annotated[StrictStr, Field(description="Certificate fingerPrint (ID)")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + cert_attributes: CompanyCertAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Update a company certificate + + + :param finger_print: Certificate fingerPrint (ID) (required) + :type finger_print: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param cert_attributes: (required) + :type cert_attributes: CompanyCertAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_finger_print_update_post_serialize( + finger_print=finger_print, + session_token=session_token, + cert_attributes=cert_attributes, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_companycert_finger_print_update_post_without_preload_content( + self, + finger_print: Annotated[StrictStr, Field(description="Certificate fingerPrint (ID)")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + cert_attributes: CompanyCertAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update a company certificate + + + :param finger_print: Certificate fingerPrint (ID) (required) + :type finger_print: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param cert_attributes: (required) + :type cert_attributes: CompanyCertAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_finger_print_update_post_serialize( + finger_print=finger_print, + session_token=session_token, + cert_attributes=cert_attributes, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_companycert_finger_print_update_post_serialize( self, finger_print, session_token, cert_attributes, - **kwargs - ): - """Update a company certificate # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_companycert_finger_print_update_post(finger_print, session_token, cert_attributes, async_req=True) - >>> result = thread.get() - - Args: - finger_print (str): Certificate fingerPrint (ID) - session_token (str): Session authentication token. - cert_attributes (CompanyCertAttributes): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['finger_print'] = \ - finger_print - kwargs['session_token'] = \ - session_token - kwargs['cert_attributes'] = \ - cert_attributes - return self.v1_companycert_finger_print_update_post_endpoint.call_with_http_info(**kwargs) - - def v1_companycert_list_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if finger_print is not None: + _path_params['fingerPrint'] = finger_print + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if cert_attributes is not None: + _body_params = cert_attributes + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/companycert/{fingerPrint}/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_companycert_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Pagination start")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Row limit")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[CompanyCertInfoListInner]: + """List all trusted certs + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Pagination start + :type skip: int + :param limit: Row limit + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_list_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_companycert_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Pagination start")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Row limit")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[CompanyCertInfoListInner]]: + """List all trusted certs + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Pagination start + :type skip: int + :param limit: Row limit + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_list_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_companycert_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Pagination start")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Row limit")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all trusted certs + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Pagination start + :type skip: int + :param limit: Row limit + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_list_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_companycert_list_get_serialize( self, session_token, - **kwargs - ): - """List all trusted certs # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_companycert_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - skip (int): Pagination start. [optional] - limit (int): Row limit. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - CompanyCertInfoList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_companycert_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_companycert_podmanaged_list_get( + skip, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/companycert/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_companycert_podmanaged_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Pagination start")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Row limit")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[CompanyCertInfoListInner]: + """List all trusted certs + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Pagination start + :type skip: int + :param limit: Row limit + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_podmanaged_list_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_companycert_podmanaged_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Pagination start")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Row limit")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[CompanyCertInfoListInner]]: + """List all trusted certs + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Pagination start + :type skip: int + :param limit: Row limit + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_podmanaged_list_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_companycert_podmanaged_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Pagination start")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Row limit")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all trusted certs + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Pagination start + :type skip: int + :param limit: Row limit + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_podmanaged_list_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_companycert_podmanaged_list_get_serialize( self, session_token, - **kwargs - ): - """List all trusted certs # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_companycert_podmanaged_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - skip (int): Pagination start. [optional] - limit (int): Row limit. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - CompanyCertInfoList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_companycert_podmanaged_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_companycert_type_list_post( + skip, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/companycert/podmanaged/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_companycert_type_list_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + type_id_list: Annotated[List[CompanyCertType], Field(description="Certificate type list")], + skip: Annotated[Optional[StrictInt], Field(description="Pagination start")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Row limit")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[CompanyCertInfoListInner]: + """List all certs of the given types + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param type_id_list: Certificate type list (required) + :type type_id_list: List[CompanyCertType] + :param skip: Pagination start + :type skip: int + :param limit: Row limit + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_type_list_post_serialize( + session_token=session_token, + type_id_list=type_id_list, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_companycert_type_list_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + type_id_list: Annotated[List[CompanyCertType], Field(description="Certificate type list")], + skip: Annotated[Optional[StrictInt], Field(description="Pagination start")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Row limit")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[CompanyCertInfoListInner]]: + """List all certs of the given types + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param type_id_list: Certificate type list (required) + :type type_id_list: List[CompanyCertType] + :param skip: Pagination start + :type skip: int + :param limit: Row limit + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_type_list_post_serialize( + session_token=session_token, + type_id_list=type_id_list, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_companycert_type_list_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + type_id_list: Annotated[List[CompanyCertType], Field(description="Certificate type list")], + skip: Annotated[Optional[StrictInt], Field(description="Pagination start")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Row limit")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List all certs of the given types + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param type_id_list: Certificate type list (required) + :type type_id_list: List[CompanyCertType] + :param skip: Pagination start + :type skip: int + :param limit: Row limit + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_companycert_type_list_post_serialize( + session_token=session_token, + type_id_list=type_id_list, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[CompanyCertInfoListInner]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_companycert_type_list_post_serialize( self, session_token, type_id_list, - **kwargs - ): - """List all certs of the given types # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_companycert_type_list_post(session_token, type_id_list, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - type_id_list (CompanyCertTypeList): Certificate type list - - Keyword Args: - skip (int): Pagination start. [optional] - limit (int): Row limit. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - CompanyCertInfoList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['type_id_list'] = \ - type_id_list - return self.v1_companycert_type_list_post_endpoint.call_with_http_info(**kwargs) - - def v2_companycert_create_post( + skip, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'typeIdList': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if type_id_list is not None: + _body_params = type_id_list + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/companycert/type/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_companycert_create_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + cert: CompanyCert, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CompanyCertDetail: + """Create a company trusted or untrusted certificate. Different from V1 in that we reject expired certificates. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param cert: (required) + :type cert: CompanyCert + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_companycert_create_post_serialize( + session_token=session_token, + cert=cert, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CompanyCertDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_companycert_create_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + cert: CompanyCert, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CompanyCertDetail]: + """Create a company trusted or untrusted certificate. Different from V1 in that we reject expired certificates. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param cert: (required) + :type cert: CompanyCert + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_companycert_create_post_serialize( + session_token=session_token, + cert=cert, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CompanyCertDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_companycert_create_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + cert: CompanyCert, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a company trusted or untrusted certificate. Different from V1 in that we reject expired certificates. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param cert: (required) + :type cert: CompanyCert + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_companycert_create_post_serialize( + session_token=session_token, + cert=cert, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CompanyCertDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_companycert_create_post_serialize( self, session_token, cert, - **kwargs - ): - """Create a company trusted or untrusted certificate. Different from V1 in that we reject expired certificates. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_companycert_create_post(session_token, cert, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - cert (CompanyCert): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - CompanyCertDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['cert'] = \ - cert - return self.v2_companycert_create_post_endpoint.call_with_http_info(**kwargs) + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if cert is not None: + _body_params = cert + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v2/companycert/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/session_api.py b/symphony/bdk/gen/pod_api/session_api.py index cb8afb2b..77b5df31 100644 --- a/symphony/bdk/gen/pod_api/session_api.py +++ b/symphony/bdk/gen/pod_api/session_api.py @@ -1,165 +1,307 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error +from pydantic import Field, StrictStr +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.user_v2 import UserV2 +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class SessionApi(object): +class SessionApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v2_sessioninfo_get_endpoint = _Endpoint( - settings={ - 'response_type': (UserV2,), - 'auth': [], - 'endpoint_path': '/v2/sessioninfo', - 'operation_id': 'v2_sessioninfo_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - def v2_sessioninfo_get( + + @validate_call + async def v2_sessioninfo_get( self, - session_token, - **kwargs - ): - """Get information about the current user's session. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_sessioninfo_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserV2 - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserV2: + """Get information about the current user's session. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_sessioninfo_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserV2", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_sessioninfo_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserV2]: + """Get information about the current user's session. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_sessioninfo_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserV2", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True + + + @validate_call + async def v2_sessioninfo_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get information about the current user's session. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_sessioninfo_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserV2", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False + return response_data.response + + + def _v2_sessioninfo_get_serialize( + self, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/sessioninfo', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v2_sessioninfo_get_endpoint.call_with_http_info(**kwargs) + diff --git a/symphony/bdk/gen/pod_api/streams_api.py b/symphony/bdk/gen/pod_api/streams_api.py index 09834b0a..62e1f6a3 100644 --- a/symphony/bdk/gen/pod_api/streams_api.py +++ b/symphony/bdk/gen/pod_api/streams_api.py @@ -1,33 +1,29 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error +from pydantic import Field, StrictBool, StrictInt, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.room_detail import RoomDetail from symphony.bdk.gen.pod_model.stream import Stream -from symphony.bdk.gen.pod_model.stream_attachment_response import StreamAttachmentResponse +from symphony.bdk.gen.pod_model.stream_attachment_item import StreamAttachmentItem +from symphony.bdk.gen.pod_model.stream_attributes import StreamAttributes from symphony.bdk.gen.pod_model.stream_filter import StreamFilter -from symphony.bdk.gen.pod_model.stream_list import StreamList -from symphony.bdk.gen.pod_model.user_id_list import UserIdList from symphony.bdk.gen.pod_model.v1_im_attributes import V1IMAttributes from symphony.bdk.gen.pod_model.v1_im_detail import V1IMDetail from symphony.bdk.gen.pod_model.v2_admin_stream_filter import V2AdminStreamFilter @@ -39,2332 +35,5040 @@ from symphony.bdk.gen.pod_model.v3_room_detail import V3RoomDetail from symphony.bdk.gen.pod_model.v3_room_search_results import V3RoomSearchResults +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class StreamsApi(object): + +class StreamsApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_admin_im_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (Stream,), - 'auth': [], - 'endpoint_path': '/v1/admin/im/create', - 'operation_id': 'v1_admin_im_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid_list', - ], - 'required': [ - 'session_token', - 'uid_list', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid_list': - (UserIdList,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'uid_list': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_room_id_set_active_post_endpoint = _Endpoint( - settings={ - 'response_type': (RoomDetail,), - 'auth': [], - 'endpoint_path': '/v1/admin/room/{id}/setActive', - 'operation_id': 'v1_admin_room_id_set_active_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'active', - 'session_token', - ], - 'required': [ - 'id', - 'active', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'active': - (bool,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'id': 'id', - 'active': 'active', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'active': 'query', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_stream_id_membership_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2MembershipList,), - 'auth': [], - 'endpoint_path': '/v1/admin/stream/{id}/membership/list', - 'operation_id': 'v1_admin_stream_id_membership_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'skip', - 'limit', - ], - 'required': [ - 'id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'skip': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_user_uid_streams_list_post_endpoint = _Endpoint( - settings={ - 'response_type': (StreamList,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/streams/list', - 'operation_id': 'v1_admin_user_uid_streams_list_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'skip', - 'limit', - 'filter', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'skip': - (int,), - 'limit': - (int,), - 'filter': - (StreamFilter,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'skip': 'query', - 'limit': 'query', - 'filter': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_im_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (Stream,), - 'auth': [], - 'endpoint_path': '/v1/im/create', - 'operation_id': 'v1_im_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid_list', - ], - 'required': [ - 'session_token', - 'uid_list', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid_list': - (UserIdList,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'uid_list': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_im_id_info_get_endpoint = _Endpoint( - settings={ - 'response_type': (V1IMDetail,), - 'auth': [], - 'endpoint_path': '/v1/im/{id}/info', - 'operation_id': 'v1_im_id_info_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - ], - 'required': [ - 'id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_im_id_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (V1IMDetail,), - 'auth': [], - 'endpoint_path': '/v1/im/{id}/update', - 'operation_id': 'v1_im_id_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'payload', - ], - 'required': [ - 'id', - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'payload': - (V1IMAttributes,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_room_id_set_active_post_endpoint = _Endpoint( - settings={ - 'response_type': (RoomDetail,), - 'auth': [], - 'endpoint_path': '/v1/room/{id}/setActive', - 'operation_id': 'v1_room_id_set_active_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'active', - 'session_token', - ], - 'required': [ - 'id', - 'active', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'active': - (bool,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'id': 'id', - 'active': 'active', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'active': 'query', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_streams_list_post_endpoint = _Endpoint( - settings={ - 'response_type': (StreamList,), - 'auth': [], - 'endpoint_path': '/v1/streams/list', - 'operation_id': 'v1_streams_list_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'skip', - 'limit', - 'filter', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - 'filter': - (StreamFilter,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'skip': 'query', - 'limit': 'query', - 'filter': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_streams_sid_attachments_get_endpoint = _Endpoint( - settings={ - 'response_type': (StreamAttachmentResponse,), - 'auth': [], - 'endpoint_path': '/v1/streams/{sid}/attachments', - 'operation_id': 'v1_streams_sid_attachments_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'session_token', - 'since', - 'to', - 'limit', - 'sort_dir', - ], - 'required': [ - 'sid', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'session_token': - (str,), - 'since': - (int,), - 'to': - (int,), - 'limit': - (int,), - 'sort_dir': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'session_token': 'sessionToken', - 'since': 'since', - 'to': 'to', - 'limit': 'limit', - 'sort_dir': 'sortDir', - }, - 'location_map': { - 'sid': 'path', - 'session_token': 'header', - 'since': 'query', - 'to': 'query', - 'limit': 'query', - 'sort_dir': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v2_admin_streams_list_post_endpoint = _Endpoint( - settings={ - 'response_type': (V2AdminStreamList,), - 'auth': [], - 'endpoint_path': '/v2/admin/streams/list', - 'operation_id': 'v2_admin_streams_list_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'skip', - 'limit', - 'filter', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - 'filter': - (V2AdminStreamFilter,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'skip': 'query', - 'limit': 'query', - 'filter': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v2_streams_sid_info_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2StreamAttributes,), - 'auth': [], - 'endpoint_path': '/v2/streams/{sid}/info', - 'operation_id': 'v2_streams_sid_info_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'sid', - 'session_token', - ], - 'required': [ - 'sid', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'sid': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'sid': 'sid', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'sid': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_room_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (V3RoomDetail,), - 'auth': [], - 'endpoint_path': '/v3/room/create', - 'operation_id': 'v3_room_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'payload', - ], - 'required': [ - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'payload': - (V3RoomAttributes,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v3_room_id_info_get_endpoint = _Endpoint( - settings={ - 'response_type': (V3RoomDetail,), - 'auth': [], - 'endpoint_path': '/v3/room/{id}/info', - 'operation_id': 'v3_room_id_info_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - ], - 'required': [ - 'id', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_room_id_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (V3RoomDetail,), - 'auth': [], - 'endpoint_path': '/v3/room/{id}/update', - 'operation_id': 'v3_room_id_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'id', - 'session_token', - 'payload', - ], - 'required': [ - 'id', - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'id': - (str,), - 'session_token': - (str,), - 'payload': - (V3RoomAttributes,), - }, - 'attribute_map': { - 'id': 'id', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'id': 'path', - 'session_token': 'header', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v3_room_search_post_endpoint = _Endpoint( - settings={ - 'response_type': (V3RoomSearchResults,), - 'auth': [], - 'endpoint_path': '/v3/room/search', - 'operation_id': 'v3_room_search_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'query', - 'skip', - 'limit', - 'include_non_discoverable', - ], - 'required': [ - 'session_token', - 'query', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'query': - (V2RoomSearchCriteria,), - 'skip': - (int,), - 'limit': - (int,), - 'include_non_discoverable': - (bool,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - 'include_non_discoverable': 'includeNonDiscoverable', - }, - 'location_map': { - 'session_token': 'header', - 'query': 'body', - 'skip': 'query', - 'limit': 'query', - 'include_non_discoverable': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client + + + @validate_call + async def v1_admin_im_create_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid_list: Annotated[List[StrictInt], Field(description="List of (integer) User IDs of participants")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Stream: + """Create a new single or multi party instant message conversation + + At least two user IDs must be provided or an error response will be sent. The caller is not included in the members of the created chat. Duplicate users will be included in the membership of the chat but the duplication will be silently ignored. If there is an existing IM conversation with the same set of participants then the id of that existing stream will be returned. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid_list: List of (integer) User IDs of participants (required) + :type uid_list: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_im_create_post_serialize( + session_token=session_token, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Stream", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_im_create_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid_list: Annotated[List[StrictInt], Field(description="List of (integer) User IDs of participants")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Stream]: + """Create a new single or multi party instant message conversation + + At least two user IDs must be provided or an error response will be sent. The caller is not included in the members of the created chat. Duplicate users will be included in the membership of the chat but the duplication will be silently ignored. If there is an existing IM conversation with the same set of participants then the id of that existing stream will be returned. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid_list: List of (integer) User IDs of participants (required) + :type uid_list: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_im_create_post_serialize( + session_token=session_token, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Stream", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_im_create_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid_list: Annotated[List[StrictInt], Field(description="List of (integer) User IDs of participants")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new single or multi party instant message conversation + + At least two user IDs must be provided or an error response will be sent. The caller is not included in the members of the created chat. Duplicate users will be included in the membership of the chat but the duplication will be silently ignored. If there is an existing IM conversation with the same set of participants then the id of that existing stream will be returned. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid_list: List of (integer) User IDs of participants (required) + :type uid_list: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_im_create_post_serialize( + session_token=session_token, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index ) - def v1_admin_im_create_post( + _response_types_map: Dict[str, Optional[str]] = { + '200': "Stream", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_im_create_post_serialize( self, session_token, uid_list, - **kwargs - ): - """Create a new single or multi party instant message conversation # noqa: E501 - - At least two user IDs must be provided or an error response will be sent. The caller is not included in the members of the created chat. Duplicate users will be included in the membership of the chat but the duplication will be silently ignored. If there is an existing IM conversation with the same set of participants then the id of that existing stream will be returned. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_im_create_post(session_token, uid_list, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid_list (UserIdList): List of (integer) User IDs of participants - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Stream - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid_list'] = \ - uid_list - return self.v1_admin_im_create_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_room_id_set_active_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'uidList': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if uid_list is not None: + _body_params = uid_list + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/im/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_room_id_set_active_post( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + active: StrictBool, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RoomDetail: + """Deactivate or reactivate a chatroom via AC Portal. + + + :param id: Room streamId (required) + :type id: str + :param active: (required) + :type active: bool + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_set_active_post_serialize( + id=id, + active=active, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_room_id_set_active_post_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + active: StrictBool, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RoomDetail]: + """Deactivate or reactivate a chatroom via AC Portal. + + + :param id: Room streamId (required) + :type id: str + :param active: (required) + :type active: bool + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_set_active_post_serialize( + id=id, + active=active, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_room_id_set_active_post_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + active: StrictBool, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Deactivate or reactivate a chatroom via AC Portal. + + + :param id: Room streamId (required) + :type id: str + :param active: (required) + :type active: bool + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_room_id_set_active_post_serialize( + id=id, + active=active, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_room_id_set_active_post_serialize( self, id, active, session_token, - **kwargs - ): - """Deactivate or reactivate a chatroom via AC Portal. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_room_id_set_active_post(id, active, session_token, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - active (bool): - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - RoomDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['active'] = \ - active - kwargs['session_token'] = \ - session_token - return self.v1_admin_room_id_set_active_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_stream_id_membership_list_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if active is not None: + + _query_params.append(('active', active)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/room/{id}/setActive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_stream_id_membership_list_get( self, - id, - session_token, - **kwargs - ): - """List the current members of an existing stream. The stream can be of type IM, MIM, or ROOM # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_stream_id_membership_list_get(id, session_token, async_req=True) - >>> result = thread.get() - - Args: - id (str): stream Id - session_token (str): Session authentication token. - - Keyword Args: - skip (int): Number of items to skip. Default is 0.. [optional] - limit (int): Maximum number of items to return. Default is 100 and not to exceed 1000.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2MembershipList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - return self.v1_admin_stream_id_membership_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_streams_list_post( + id: Annotated[StrictStr, Field(description="stream Id")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of items to skip. Default is 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of items to return. Default is 100 and not to exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2MembershipList: + """List the current members of an existing stream. The stream can be of type IM, MIM, or ROOM + + + :param id: stream Id (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of items to skip. Default is 0. + :type skip: int + :param limit: Maximum number of items to return. Default is 100 and not to exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_stream_id_membership_list_get_serialize( + id=id, + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2MembershipList", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_stream_id_membership_list_get_with_http_info( self, - session_token, - uid, - **kwargs - ): - """Retrieve a list of all streams of which this user is a member, sorted by creation date (ascending). Since SBE 20.16. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_streams_list_post(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - - Keyword Args: - skip (int): No. of results to skip. . [optional] - limit (int): Max no. of results to return. If no value is provided, 50 is the default. . [optional] - filter (StreamFilter): Stream filtering criteria.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - StreamList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v1_admin_user_uid_streams_list_post_endpoint.call_with_http_info(**kwargs) - - def v1_im_create_post( + id: Annotated[StrictStr, Field(description="stream Id")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of items to skip. Default is 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of items to return. Default is 100 and not to exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2MembershipList]: + """List the current members of an existing stream. The stream can be of type IM, MIM, or ROOM + + + :param id: stream Id (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of items to skip. Default is 0. + :type skip: int + :param limit: Maximum number of items to return. Default is 100 and not to exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_stream_id_membership_list_get_serialize( + id=id, + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2MembershipList", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_stream_id_membership_list_get_without_preload_content( self, - session_token, - uid_list, - **kwargs - ): - """Create a new single or multi party instant message conversation between the caller and specified users. # noqa: E501 - - At least one user ID must be provided or an error response will be sent. The caller is implicitly included in the members of the created chat. Duplicate users will be included in the membership of the chat but the duplication will be silently ignored. If there is an existing IM conversation with the same set of participants then the id of that existing stream will be returned. This method was incorrectly specified to take a query parameter in version 1.0 of this specification but now expects a JSON array of user IDs in the body of the request. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_im_create_post(session_token, uid_list, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid_list (UserIdList): List of (integer) User IDs of participants - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Stream - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid_list'] = \ - uid_list - return self.v1_im_create_post_endpoint.call_with_http_info(**kwargs) - - def v1_im_id_info_get( + id: Annotated[StrictStr, Field(description="stream Id")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of items to skip. Default is 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of items to return. Default is 100 and not to exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List the current members of an existing stream. The stream can be of type IM, MIM, or ROOM + + + :param id: stream Id (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of items to skip. Default is 0. + :type skip: int + :param limit: Maximum number of items to return. Default is 100 and not to exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_stream_id_membership_list_get_serialize( + id=id, + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2MembershipList", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_stream_id_membership_list_get_serialize( self, id, session_token, - **kwargs - ): - """Get information about a partcular IM. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_im_id_info_get(id, session_token, async_req=True) - >>> result = thread.get() - - Args: - id (str): IM streamId - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1IMDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - return self.v1_im_id_info_get_endpoint.call_with_http_info(**kwargs) - - def v1_im_id_update_post( + skip, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/stream/{id}/membership/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_streams_list_post( self, - id, - session_token, - payload, - **kwargs - ): - """Update the attributes of an existing IM. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_im_id_update_post(id, session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - id (str): IM streamID - session_token (str): Session authentication token. - payload (V1IMAttributes): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1IMDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v1_im_id_update_post_endpoint.call_with_http_info(**kwargs) - - def v1_room_id_set_active_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default. ")] = None, + filter: Annotated[Optional[StreamFilter], Field(description="Stream filtering criteria.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[StreamAttributes]: + """Retrieve a list of all streams of which this user is a member, sorted by creation date (ascending). Since SBE 20.16. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param filter: Stream filtering criteria. + :type filter: StreamFilter + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_streams_list_post_serialize( + session_token=session_token, + uid=uid, + skip=skip, + limit=limit, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[StreamAttributes]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_streams_list_post_with_http_info( self, - id, - active, - session_token, - **kwargs - ): - """Deactivate or reactivate a chatroom. At creation, a new chatroom is active. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_room_id_set_active_post(id, active, session_token, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - active (bool): - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - RoomDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['active'] = \ - active - kwargs['session_token'] = \ - session_token - return self.v1_room_id_set_active_post_endpoint.call_with_http_info(**kwargs) - - def v1_streams_list_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default. ")] = None, + filter: Annotated[Optional[StreamFilter], Field(description="Stream filtering criteria.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[StreamAttributes]]: + """Retrieve a list of all streams of which this user is a member, sorted by creation date (ascending). Since SBE 20.16. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param filter: Stream filtering criteria. + :type filter: StreamFilter + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_streams_list_post_serialize( + session_token=session_token, + uid=uid, + skip=skip, + limit=limit, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[StreamAttributes]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_streams_list_post_without_preload_content( self, - session_token, - **kwargs - ): - """Retrieve a list of all streams of which the requesting user is a member, sorted by creation date (ascending). # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_streams_list_post(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - skip (int): No. of results to skip. . [optional] - limit (int): Max no. of results to return. If no value is provided, 50 is the default. . [optional] - filter (StreamFilter): Stream filtering criteria.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - StreamList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_streams_list_post_endpoint.call_with_http_info(**kwargs) - - def v1_streams_sid_attachments_get( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default. ")] = None, + filter: Annotated[Optional[StreamFilter], Field(description="Stream filtering criteria.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a list of all streams of which this user is a member, sorted by creation date (ascending). Since SBE 20.16. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param filter: Stream filtering criteria. + :type filter: StreamFilter + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_streams_list_post_serialize( + session_token=session_token, + uid=uid, + skip=skip, + limit=limit, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[StreamAttributes]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_streams_list_post_serialize( self, - sid, session_token, - **kwargs - ): - """Get attachments in a particular stream. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_streams_sid_attachments_get(sid, session_token, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream Id - session_token (str): Session authentication token. - - Keyword Args: - since (int): Timestamp of first required attachment. This is a long integer value representing milliseconds since Jan 1 1970 . [optional] - to (int): Timestamp of last required attachment. This is a long integer value representing milliseconds since Jan 1 1970 . [optional] - limit (int): Maximum number of attachments to return. Default is 50. Must be a positive integer and must not exceed 100.. [optional] - sort_dir (str): Attachment date sort direction : ASC or DESC (default to ASC) . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - StreamAttachmentResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['session_token'] = \ - session_token - return self.v1_streams_sid_attachments_get_endpoint.call_with_http_info(**kwargs) - - def v2_admin_streams_list_post( + uid, + skip, + limit, + filter, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if filter is not None: + _body_params = filter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/user/{uid}/streams/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_im_create_post( self, - session_token, - **kwargs - ): - """Retrieve all the streams across the enterprise where the membership of the stream has been modified between a given time range # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_admin_streams_list_post(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - skip (int): Number of items to skip. Default is 0. . [optional] - limit (int): Maximum number of items to return. Default is 50. This value cannot exceed 100. . [optional] - filter (V2AdminStreamFilter): Stream filtering criteria.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2AdminStreamList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v2_admin_streams_list_post_endpoint.call_with_http_info(**kwargs) - - def v2_streams_sid_info_get( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid_list: Annotated[List[StrictInt], Field(description="List of (integer) User IDs of participants")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Stream: + """Create a new single or multi party instant message conversation between the caller and specified users. + + At least one user ID must be provided or an error response will be sent. The caller is implicitly included in the members of the created chat. Duplicate users will be included in the membership of the chat but the duplication will be silently ignored. If there is an existing IM conversation with the same set of participants then the id of that existing stream will be returned. This method was incorrectly specified to take a query parameter in version 1.0 of this specification but now expects a JSON array of user IDs in the body of the request. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid_list: List of (integer) User IDs of participants (required) + :type uid_list: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_im_create_post_serialize( + session_token=session_token, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Stream", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_im_create_post_with_http_info( self, - sid, - session_token, - **kwargs - ): - """Get information about a partcular stream. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_streams_sid_info_get(sid, session_token, async_req=True) - >>> result = thread.get() - - Args: - sid (str): Stream Id - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2StreamAttributes - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['sid'] = \ - sid - kwargs['session_token'] = \ - session_token - return self.v2_streams_sid_info_get_endpoint.call_with_http_info(**kwargs) - - def v3_room_create_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid_list: Annotated[List[StrictInt], Field(description="List of (integer) User IDs of participants")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Stream]: + """Create a new single or multi party instant message conversation between the caller and specified users. + + At least one user ID must be provided or an error response will be sent. The caller is implicitly included in the members of the created chat. Duplicate users will be included in the membership of the chat but the duplication will be silently ignored. If there is an existing IM conversation with the same set of participants then the id of that existing stream will be returned. This method was incorrectly specified to take a query parameter in version 1.0 of this specification but now expects a JSON array of user IDs in the body of the request. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid_list: List of (integer) User IDs of participants (required) + :type uid_list: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_im_create_post_serialize( + session_token=session_token, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Stream", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_im_create_post_without_preload_content( self, - session_token, - payload, - **kwargs - ): - """Create a new chatroom. # noqa: E501 - - Create a new chatroom. If no attributes are specified, the room is created as a private chatroom. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v3_room_create_post(session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - payload (V3RoomAttributes): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3RoomDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v3_room_create_post_endpoint.call_with_http_info(**kwargs) - - def v3_room_id_info_get( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid_list: Annotated[List[StrictInt], Field(description="List of (integer) User IDs of participants")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new single or multi party instant message conversation between the caller and specified users. + + At least one user ID must be provided or an error response will be sent. The caller is implicitly included in the members of the created chat. Duplicate users will be included in the membership of the chat but the duplication will be silently ignored. If there is an existing IM conversation with the same set of participants then the id of that existing stream will be returned. This method was incorrectly specified to take a query parameter in version 1.0 of this specification but now expects a JSON array of user IDs in the body of the request. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid_list: List of (integer) User IDs of participants (required) + :type uid_list: List[int] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_im_create_post_serialize( + session_token=session_token, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Stream", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_im_create_post_serialize( self, - id, session_token, - **kwargs - ): - """Get information about a partcular chatroom. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v3_room_id_info_get(id, session_token, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3RoomDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - return self.v3_room_id_info_get_endpoint.call_with_http_info(**kwargs) - - def v3_room_id_update_post( + uid_list, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'uidList': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if uid_list is not None: + _body_params = uid_list + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/im/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_im_id_info_get( + self, + id: Annotated[StrictStr, Field(description="IM streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1IMDetail: + """Get information about a partcular IM. + + + :param id: IM streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_im_id_info_get_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1IMDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_im_id_info_get_with_http_info( + self, + id: Annotated[StrictStr, Field(description="IM streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1IMDetail]: + """Get information about a partcular IM. + + + :param id: IM streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_im_id_info_get_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1IMDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_im_id_info_get_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="IM streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get information about a partcular IM. + + + :param id: IM streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_im_id_info_get_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1IMDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_im_id_info_get_serialize( + self, + id, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/im/{id}/info', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_im_id_update_post( + self, + id: Annotated[StrictStr, Field(description="IM streamID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V1IMAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1IMDetail: + """Update the attributes of an existing IM. + + + :param id: IM streamID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V1IMAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_im_id_update_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1IMDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '451': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_im_id_update_post_with_http_info( + self, + id: Annotated[StrictStr, Field(description="IM streamID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V1IMAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1IMDetail]: + """Update the attributes of an existing IM. + + + :param id: IM streamID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V1IMAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_im_id_update_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1IMDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '451': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_im_id_update_post_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="IM streamID")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V1IMAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the attributes of an existing IM. + + + :param id: IM streamID (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V1IMAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_im_id_update_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1IMDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '451': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_im_id_update_post_serialize( + self, + id, + session_token, + payload, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/im/{id}/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_room_id_set_active_post( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + active: StrictBool, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RoomDetail: + """Deactivate or reactivate a chatroom. At creation, a new chatroom is active. + + + :param id: Room streamId (required) + :type id: str + :param active: (required) + :type active: bool + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_set_active_post_serialize( + id=id, + active=active, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_room_id_set_active_post_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + active: StrictBool, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RoomDetail]: + """Deactivate or reactivate a chatroom. At creation, a new chatroom is active. + + + :param id: Room streamId (required) + :type id: str + :param active: (required) + :type active: bool + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_set_active_post_serialize( + id=id, + active=active, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_room_id_set_active_post_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + active: StrictBool, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Deactivate or reactivate a chatroom. At creation, a new chatroom is active. + + + :param id: Room streamId (required) + :type id: str + :param active: (required) + :type active: bool + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_room_id_set_active_post_serialize( + id=id, + active=active, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_room_id_set_active_post_serialize( + self, + id, + active, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if active is not None: + + _query_params.append(('active', active)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/room/{id}/setActive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_streams_list_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default. ")] = None, + filter: Annotated[Optional[StreamFilter], Field(description="Stream filtering criteria.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[StreamAttributes]: + """Retrieve a list of all streams of which the requesting user is a member, sorted by creation date (ascending). + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param filter: Stream filtering criteria. + :type filter: StreamFilter + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_streams_list_post_serialize( + session_token=session_token, + skip=skip, + limit=limit, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[StreamAttributes]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_streams_list_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default. ")] = None, + filter: Annotated[Optional[StreamFilter], Field(description="Stream filtering criteria.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[StreamAttributes]]: + """Retrieve a list of all streams of which the requesting user is a member, sorted by creation date (ascending). + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param filter: Stream filtering criteria. + :type filter: StreamFilter + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_streams_list_post_serialize( + session_token=session_token, + skip=skip, + limit=limit, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[StreamAttributes]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_streams_list_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default. ")] = None, + filter: Annotated[Optional[StreamFilter], Field(description="Stream filtering criteria.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a list of all streams of which the requesting user is a member, sorted by creation date (ascending). + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. + :type limit: int + :param filter: Stream filtering criteria. + :type filter: StreamFilter + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_streams_list_post_serialize( + session_token=session_token, + skip=skip, + limit=limit, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[StreamAttributes]", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_streams_list_post_serialize( + self, + session_token, + skip, + limit, + filter, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if filter is not None: + _body_params = filter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/streams/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_streams_sid_attachments_get( + self, + sid: Annotated[StrictStr, Field(description="Stream Id")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + since: Annotated[Optional[StrictInt], Field(description="Timestamp of first required attachment. This is a long integer value representing milliseconds since Jan 1 1970 ")] = None, + to: Annotated[Optional[StrictInt], Field(description="Timestamp of last required attachment. This is a long integer value representing milliseconds since Jan 1 1970 ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of attachments to return. Default is 50. Must be a positive integer and must not exceed 100.")] = None, + sort_dir: Annotated[Optional[StrictStr], Field(description="Attachment date sort direction : ASC or DESC (default to ASC) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[StreamAttachmentItem]: + """Get attachments in a particular stream. + + + :param sid: Stream Id (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param since: Timestamp of first required attachment. This is a long integer value representing milliseconds since Jan 1 1970 + :type since: int + :param to: Timestamp of last required attachment. This is a long integer value representing milliseconds since Jan 1 1970 + :type to: int + :param limit: Maximum number of attachments to return. Default is 50. Must be a positive integer and must not exceed 100. + :type limit: int + :param sort_dir: Attachment date sort direction : ASC or DESC (default to ASC) + :type sort_dir: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_streams_sid_attachments_get_serialize( + sid=sid, + session_token=session_token, + since=since, + to=to, + limit=limit, + sort_dir=sort_dir, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[StreamAttachmentItem]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_streams_sid_attachments_get_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream Id")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + since: Annotated[Optional[StrictInt], Field(description="Timestamp of first required attachment. This is a long integer value representing milliseconds since Jan 1 1970 ")] = None, + to: Annotated[Optional[StrictInt], Field(description="Timestamp of last required attachment. This is a long integer value representing milliseconds since Jan 1 1970 ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of attachments to return. Default is 50. Must be a positive integer and must not exceed 100.")] = None, + sort_dir: Annotated[Optional[StrictStr], Field(description="Attachment date sort direction : ASC or DESC (default to ASC) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[StreamAttachmentItem]]: + """Get attachments in a particular stream. + + + :param sid: Stream Id (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param since: Timestamp of first required attachment. This is a long integer value representing milliseconds since Jan 1 1970 + :type since: int + :param to: Timestamp of last required attachment. This is a long integer value representing milliseconds since Jan 1 1970 + :type to: int + :param limit: Maximum number of attachments to return. Default is 50. Must be a positive integer and must not exceed 100. + :type limit: int + :param sort_dir: Attachment date sort direction : ASC or DESC (default to ASC) + :type sort_dir: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_streams_sid_attachments_get_serialize( + sid=sid, + session_token=session_token, + since=since, + to=to, + limit=limit, + sort_dir=sort_dir, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[StreamAttachmentItem]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_streams_sid_attachments_get_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream Id")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + since: Annotated[Optional[StrictInt], Field(description="Timestamp of first required attachment. This is a long integer value representing milliseconds since Jan 1 1970 ")] = None, + to: Annotated[Optional[StrictInt], Field(description="Timestamp of last required attachment. This is a long integer value representing milliseconds since Jan 1 1970 ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of attachments to return. Default is 50. Must be a positive integer and must not exceed 100.")] = None, + sort_dir: Annotated[Optional[StrictStr], Field(description="Attachment date sort direction : ASC or DESC (default to ASC) ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get attachments in a particular stream. + + + :param sid: Stream Id (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param since: Timestamp of first required attachment. This is a long integer value representing milliseconds since Jan 1 1970 + :type since: int + :param to: Timestamp of last required attachment. This is a long integer value representing milliseconds since Jan 1 1970 + :type to: int + :param limit: Maximum number of attachments to return. Default is 50. Must be a positive integer and must not exceed 100. + :type limit: int + :param sort_dir: Attachment date sort direction : ASC or DESC (default to ASC) + :type sort_dir: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_streams_sid_attachments_get_serialize( + sid=sid, + session_token=session_token, + since=since, + to=to, + limit=limit, + sort_dir=sort_dir, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[StreamAttachmentItem]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_streams_sid_attachments_get_serialize( + self, + sid, + session_token, + since, + to, + limit, + sort_dir, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + if since is not None: + + _query_params.append(('since', since)) + + if to is not None: + + _query_params.append(('to', to)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if sort_dir is not None: + + _query_params.append(('sortDir', sort_dir)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/streams/{sid}/attachments', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_admin_streams_list_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of items to skip. Default is 0. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of items to return. Default is 50. This value cannot exceed 100. ")] = None, + filter: Annotated[Optional[V2AdminStreamFilter], Field(description="Stream filtering criteria.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2AdminStreamList: + """Retrieve all the streams across the enterprise where the membership of the stream has been modified between a given time range + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of items to skip. Default is 0. + :type skip: int + :param limit: Maximum number of items to return. Default is 50. This value cannot exceed 100. + :type limit: int + :param filter: Stream filtering criteria. + :type filter: V2AdminStreamFilter + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_streams_list_post_serialize( + session_token=session_token, + skip=skip, + limit=limit, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2AdminStreamList", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_admin_streams_list_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of items to skip. Default is 0. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of items to return. Default is 50. This value cannot exceed 100. ")] = None, + filter: Annotated[Optional[V2AdminStreamFilter], Field(description="Stream filtering criteria.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2AdminStreamList]: + """Retrieve all the streams across the enterprise where the membership of the stream has been modified between a given time range + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of items to skip. Default is 0. + :type skip: int + :param limit: Maximum number of items to return. Default is 50. This value cannot exceed 100. + :type limit: int + :param filter: Stream filtering criteria. + :type filter: V2AdminStreamFilter + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_streams_list_post_serialize( + session_token=session_token, + skip=skip, + limit=limit, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2AdminStreamList", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_admin_streams_list_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of items to skip. Default is 0. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of items to return. Default is 50. This value cannot exceed 100. ")] = None, + filter: Annotated[Optional[V2AdminStreamFilter], Field(description="Stream filtering criteria.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve all the streams across the enterprise where the membership of the stream has been modified between a given time range + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of items to skip. Default is 0. + :type skip: int + :param limit: Maximum number of items to return. Default is 50. This value cannot exceed 100. + :type limit: int + :param filter: Stream filtering criteria. + :type filter: V2AdminStreamFilter + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_streams_list_post_serialize( + session_token=session_token, + skip=skip, + limit=limit, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2AdminStreamList", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_admin_streams_list_post_serialize( + self, + session_token, + skip, + limit, + filter, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if filter is not None: + _body_params = filter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v2/admin/streams/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_streams_sid_info_get( + self, + sid: Annotated[StrictStr, Field(description="Stream Id")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2StreamAttributes: + """Get information about a partcular stream. + + + :param sid: Stream Id (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_streams_sid_info_get_serialize( + sid=sid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2StreamAttributes", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_streams_sid_info_get_with_http_info( + self, + sid: Annotated[StrictStr, Field(description="Stream Id")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2StreamAttributes]: + """Get information about a partcular stream. + + + :param sid: Stream Id (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_streams_sid_info_get_serialize( + sid=sid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2StreamAttributes", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_streams_sid_info_get_without_preload_content( + self, + sid: Annotated[StrictStr, Field(description="Stream Id")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get information about a partcular stream. + + + :param sid: Stream Id (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_streams_sid_info_get_serialize( + sid=sid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2StreamAttributes", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_streams_sid_info_get_serialize( + self, + sid, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/streams/{sid}/info', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_room_create_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V3RoomAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3RoomDetail: + """Create a new chatroom. + + Create a new chatroom. If no attributes are specified, the room is created as a private chatroom. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V3RoomAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_create_post_serialize( + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '451': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_room_create_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V3RoomAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3RoomDetail]: + """Create a new chatroom. + + Create a new chatroom. If no attributes are specified, the room is created as a private chatroom. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V3RoomAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_create_post_serialize( + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '451': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_room_create_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V3RoomAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new chatroom. + + Create a new chatroom. If no attributes are specified, the room is created as a private chatroom. + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V3RoomAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_create_post_serialize( + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '451': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_room_create_post_serialize( + self, + session_token, + payload, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/room/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_room_id_info_get( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3RoomDetail: + """Get information about a partcular chatroom. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_id_info_get_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_room_id_info_get_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3RoomDetail]: + """Get information about a partcular chatroom. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_id_info_get_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_room_id_info_get_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get information about a partcular chatroom. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_id_info_get_serialize( + id=id, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_room_id_info_get_serialize( + self, + id, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/room/{id}/info', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_room_id_update_post( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V3RoomAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3RoomDetail: + """Update the attributes of an existing chatroom. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V3RoomAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_id_update_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '451': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_room_id_update_post_with_http_info( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V3RoomAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3RoomDetail]: + """Update the attributes of an existing chatroom. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V3RoomAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_id_update_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '451': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_room_id_update_post_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="Room streamId")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V3RoomAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the attributes of an existing chatroom. + + + :param id: Room streamId (required) + :type id: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V3RoomAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_id_update_post_serialize( + id=id, + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '451': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_room_id_update_post_serialize( self, id, session_token, payload, - **kwargs - ): - """Update the attributes of an existing chatroom. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v3_room_id_update_post(id, session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - id (str): Room streamId - session_token (str): Session authentication token. - payload (V3RoomAttributes): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3RoomDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['id'] = \ - id - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v3_room_id_update_post_endpoint.call_with_http_info(**kwargs) - - def v3_room_search_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/room/{id}/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_room_search_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + query: Annotated[V2RoomSearchCriteria, Field(description="The search query object.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default. Must be a positive integer and must not exceed 100 ")] = None, + include_non_discoverable: Annotated[Optional[StrictBool], Field(description="Whether the non discoverable rooms should be returned. false by default. Parameter introduced in sbe-25.5.0")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V3RoomSearchResults: + """Search rooms according to the specified criteria. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param query: The search query object. (required) + :type query: V2RoomSearchCriteria + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. Must be a positive integer and must not exceed 100 + :type limit: int + :param include_non_discoverable: Whether the non discoverable rooms should be returned. false by default. Parameter introduced in sbe-25.5.0 + :type include_non_discoverable: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_search_post_serialize( + session_token=session_token, + query=query, + skip=skip, + limit=limit, + include_non_discoverable=include_non_discoverable, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomSearchResults", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_room_search_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + query: Annotated[V2RoomSearchCriteria, Field(description="The search query object.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default. Must be a positive integer and must not exceed 100 ")] = None, + include_non_discoverable: Annotated[Optional[StrictBool], Field(description="Whether the non discoverable rooms should be returned. false by default. Parameter introduced in sbe-25.5.0")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V3RoomSearchResults]: + """Search rooms according to the specified criteria. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param query: The search query object. (required) + :type query: V2RoomSearchCriteria + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. Must be a positive integer and must not exceed 100 + :type limit: int + :param include_non_discoverable: Whether the non discoverable rooms should be returned. false by default. Parameter introduced in sbe-25.5.0 + :type include_non_discoverable: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_search_post_serialize( + session_token=session_token, + query=query, + skip=skip, + limit=limit, + include_non_discoverable=include_non_discoverable, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomSearchResults", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_room_search_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + query: Annotated[V2RoomSearchCriteria, Field(description="The search query object.")], + skip: Annotated[Optional[StrictInt], Field(description="No. of results to skip. ")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max no. of results to return. If no value is provided, 50 is the default. Must be a positive integer and must not exceed 100 ")] = None, + include_non_discoverable: Annotated[Optional[StrictBool], Field(description="Whether the non discoverable rooms should be returned. false by default. Parameter introduced in sbe-25.5.0")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Search rooms according to the specified criteria. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param query: The search query object. (required) + :type query: V2RoomSearchCriteria + :param skip: No. of results to skip. + :type skip: int + :param limit: Max no. of results to return. If no value is provided, 50 is the default. Must be a positive integer and must not exceed 100 + :type limit: int + :param include_non_discoverable: Whether the non discoverable rooms should be returned. false by default. Parameter introduced in sbe-25.5.0 + :type include_non_discoverable: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_room_search_post_serialize( + session_token=session_token, + query=query, + skip=skip, + limit=limit, + include_non_discoverable=include_non_discoverable, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V3RoomSearchResults", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_room_search_post_serialize( self, session_token, query, - **kwargs - ): - """Search rooms according to the specified criteria. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v3_room_search_post(session_token, query, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - query (V2RoomSearchCriteria): The search query object. - - Keyword Args: - skip (int): No. of results to skip. . [optional] - limit (int): Max no. of results to return. If no value is provided, 50 is the default. Must be a positive integer and must not exceed 100 . [optional] - include_non_discoverable (bool): Whether the non discoverable rooms should be returned. false by default. Parameter introduced in sbe-25.5.0. [optional] if omitted the server will use the default value of False - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V3RoomSearchResults - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['query'] = \ - query - return self.v3_room_search_post_endpoint.call_with_http_info(**kwargs) + skip, + limit, + include_non_discoverable, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if include_non_discoverable is not None: + + _query_params.append(('includeNonDiscoverable', include_non_discoverable)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if query is not None: + _body_params = query + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v3/room/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/system_api.py b/symphony/bdk/gen/pod_api/system_api.py index bcf665a6..cb286db5 100644 --- a/symphony/bdk/gen/pod_api/system_api.py +++ b/symphony/bdk/gen/pod_api/system_api.py @@ -1,703 +1,1461 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error +from pydantic import Field, StrictInt, StrictStr +from typing import List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.protocol import Protocol -from symphony.bdk.gen.pod_model.string_list import StringList +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class SystemApi(object): + +class SystemApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_admin_system_features_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (StringList,), - 'auth': [], - 'endpoint_path': '/v1/admin/system/features/list', - 'operation_id': 'v1_admin_system_features_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_system_protocols_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (StringList,), - 'auth': [], - 'endpoint_path': '/v1/admin/system/protocols/list', - 'operation_id': 'v1_admin_system_protocols_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_system_protocols_post_endpoint = _Endpoint( - settings={ - 'response_type': (Protocol,), - 'auth': [], - 'endpoint_path': '/v1/admin/system/protocols', - 'operation_id': 'v1_admin_system_protocols_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'protocol', - ], - 'required': [ - 'session_token', - 'protocol', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'protocol': - (Protocol,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'protocol': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ + + + @validate_call + async def v1_admin_system_features_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[str]: + """Get the full set of Symphony features available for this pod + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_features_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_system_features_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[str]]: + """Get the full set of Symphony features available for this pod + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_features_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_system_features_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the full set of Symphony features available for this pod + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_features_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_system_features_list_get_serialize( + self, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' ] - }, - api_client=api_client - ) - self.v1_admin_system_protocols_scheme_delete_endpoint = _Endpoint( - settings={ - 'response_type': None, - 'auth': [], - 'endpoint_path': '/v1/admin/system/protocols/{scheme}', - 'operation_id': 'v1_admin_system_protocols_scheme_delete', - 'http_method': 'DELETE', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'scheme', - ], - 'required': [ - 'session_token', - 'scheme', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'scheme': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'scheme': 'scheme', - }, - 'location_map': { - 'session_token': 'header', - 'scheme': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/system/features/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_system_protocols_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[str]: + """Get a list of all URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_protocols_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_system_protocols_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[str]]: + """Get a list of all URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_protocols_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_system_protocols_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a list of all URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_protocols_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_system_protocols_list_get_serialize( + self, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v2_system_protocols_get_endpoint = _Endpoint( - settings={ - 'response_type': (StringList,), - 'auth': [], - 'endpoint_path': '/v2/system/protocols', - 'operation_id': 'v2_system_protocols_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'skip', - 'limit', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'skip': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/system/protocols/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def v1_admin_system_features_list_get( + + + + @validate_call + async def v1_admin_system_protocols_post( self, - session_token, - **kwargs - ): - """Get the full set of Symphony features available for this pod # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_system_features_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - StringList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_admin_system_features_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_system_protocols_list_get( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + protocol: Annotated[Protocol, Field(description="the protocol to add")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Protocol: + """Add an entry to URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param protocol: the protocol to add (required) + :type protocol: Protocol + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_protocols_post_serialize( + session_token=session_token, + protocol=protocol, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Protocol", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_system_protocols_post_with_http_info( self, - session_token, - **kwargs - ): - """Get a list of all URI protocols supported by the company (pod) # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_system_protocols_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - StringList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_admin_system_protocols_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_system_protocols_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + protocol: Annotated[Protocol, Field(description="the protocol to add")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Protocol]: + """Add an entry to URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param protocol: the protocol to add (required) + :type protocol: Protocol + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_protocols_post_serialize( + session_token=session_token, + protocol=protocol, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Protocol", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_system_protocols_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + protocol: Annotated[Protocol, Field(description="the protocol to add")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add an entry to URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param protocol: the protocol to add (required) + :type protocol: Protocol + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_protocols_post_serialize( + session_token=session_token, + protocol=protocol, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Protocol", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_system_protocols_post_serialize( self, session_token, protocol, - **kwargs - ): - """Add an entry to URI protocols supported by the company (pod) # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_system_protocols_post(session_token, protocol, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - protocol (Protocol): the protocol to add - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Protocol - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['protocol'] = \ - protocol - return self.v1_admin_system_protocols_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_system_protocols_scheme_delete( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if protocol is not None: + _body_params = protocol + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/system/protocols', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_system_protocols_scheme_delete( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + scheme: Annotated[StrictStr, Field(description="the scheme to remove from the protocols list")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Remove an entry from URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param scheme: the scheme to remove from the protocols list (required) + :type scheme: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_protocols_scheme_delete_serialize( + session_token=session_token, + scheme=scheme, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_system_protocols_scheme_delete_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + scheme: Annotated[StrictStr, Field(description="the scheme to remove from the protocols list")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Remove an entry from URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param scheme: the scheme to remove from the protocols list (required) + :type scheme: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_protocols_scheme_delete_serialize( + session_token=session_token, + scheme=scheme, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_system_protocols_scheme_delete_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + scheme: Annotated[StrictStr, Field(description="the scheme to remove from the protocols list")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remove an entry from URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param scheme: the scheme to remove from the protocols list (required) + :type scheme: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_protocols_scheme_delete_serialize( + session_token=session_token, + scheme=scheme, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_system_protocols_scheme_delete_serialize( self, session_token, scheme, - **kwargs - ): - """Remove an entry from URI protocols supported by the company (pod) # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_system_protocols_scheme_delete(session_token, scheme, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - scheme (str): the scheme to remove from the protocols list - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['scheme'] = \ - scheme - return self.v1_admin_system_protocols_scheme_delete_endpoint.call_with_http_info(**kwargs) - - def v2_system_protocols_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if scheme is not None: + _path_params['scheme'] = scheme + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/admin/system/protocols/{scheme}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_system_protocols_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of items to skip. Default is 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of items to return. Default is 100 and not to exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[str]: + """Get a list of URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of items to skip. Default is 0. + :type skip: int + :param limit: Maximum number of items to return. Default is 100 and not to exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_system_protocols_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_system_protocols_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of items to skip. Default is 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of items to return. Default is 100 and not to exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[str]]: + """Get a list of URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of items to skip. Default is 0. + :type skip: int + :param limit: Maximum number of items to return. Default is 100 and not to exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_system_protocols_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_system_protocols_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of items to skip. Default is 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of items to return. Default is 100 and not to exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a list of URI protocols supported by the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param skip: Number of items to skip. Default is 0. + :type skip: int + :param limit: Maximum number of items to return. Default is 100 and not to exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_system_protocols_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[str]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_system_protocols_get_serialize( self, session_token, - **kwargs - ): - """Get a list of URI protocols supported by the company (pod) # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_system_protocols_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - skip (int): Number of items to skip. Default is 0.. [optional] - limit (int): Maximum number of items to return. Default is 100 and not to exceed 1000.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - StringList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v2_system_protocols_get_endpoint.call_with_http_info(**kwargs) + skip, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/system/protocols', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/user_api.py b/symphony/bdk/gen/pod_api/user_api.py index cde86d35..5bb5cbb2 100644 --- a/symphony/bdk/gen/pod_api/user_api.py +++ b/symphony/bdk/gen/pod_api/user_api.py @@ -1,3747 +1,7907 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.avatar_list import AvatarList +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt, StrictStr +from typing import List, Optional +from typing_extensions import Annotated +from symphony.bdk.gen.pod_model.avatar import Avatar from symphony.bdk.gen.pod_model.avatar_update import AvatarUpdate from symphony.bdk.gen.pod_model.delegate_action import DelegateAction from symphony.bdk.gen.pod_model.disclaimer import Disclaimer -from symphony.bdk.gen.pod_model.error import Error -from symphony.bdk.gen.pod_model.feature_list import FeatureList +from symphony.bdk.gen.pod_model.feature import Feature from symphony.bdk.gen.pod_model.followers_list import FollowersList from symphony.bdk.gen.pod_model.followers_list_response import FollowersListResponse from symphony.bdk.gen.pod_model.following_list_response import FollowingListResponse -from symphony.bdk.gen.pod_model.integer_list import IntegerList -from symphony.bdk.gen.pod_model.role_detail_list import RoleDetailList +from symphony.bdk.gen.pod_model.role_detail import RoleDetail from symphony.bdk.gen.pod_model.service_account_manifest import ServiceAccountManifest from symphony.bdk.gen.pod_model.string_id import StringId from symphony.bdk.gen.pod_model.success_response import SuccessResponse -from symphony.bdk.gen.pod_model.user_detail_list import UserDetailList +from symphony.bdk.gen.pod_model.user_detail import UserDetail from symphony.bdk.gen.pod_model.user_filter import UserFilter from symphony.bdk.gen.pod_model.user_status import UserStatus from symphony.bdk.gen.pod_model.user_suspension import UserSuspension from symphony.bdk.gen.pod_model.v2_user_attributes import V2UserAttributes from symphony.bdk.gen.pod_model.v2_user_create import V2UserCreate from symphony.bdk.gen.pod_model.v2_user_detail import V2UserDetail -from symphony.bdk.gen.pod_model.v2_user_detail_list import V2UserDetailList + +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType -class UserApi(object): +class UserApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_admin_system_roles_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (RoleDetailList,), - 'auth': [], - 'endpoint_path': '/v1/admin/system/roles/list', - 'operation_id': 'v1_admin_system_roles_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_user_find_post_endpoint = _Endpoint( - settings={ - 'response_type': (UserDetailList,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/find', - 'operation_id': 'v1_admin_user_find_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'payload', - 'skip', - 'limit', - ], - 'required': [ - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'payload': - (UserFilter,), - 'skip': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'payload': 'body', - 'skip': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_user_uid_avatar_get_endpoint = _Endpoint( - settings={ - 'response_type': (AvatarList,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/avatar', - 'operation_id': 'v1_admin_user_uid_avatar_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_user_uid_avatar_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/avatar/update', - 'operation_id': 'v1_admin_user_uid_avatar_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'payload', - ], - 'required': [ - 'session_token', - 'uid', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'payload': - (AvatarUpdate,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_user_uid_delegates_get_endpoint = _Endpoint( - settings={ - 'response_type': (IntegerList,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/delegates', - 'operation_id': 'v1_admin_user_uid_delegates_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_user_uid_delegates_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/delegates/update', - 'operation_id': 'v1_admin_user_uid_delegates_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'payload', - ], - 'required': [ - 'session_token', - 'uid', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'payload': - (DelegateAction,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_user_uid_disclaimer_delete_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/disclaimer', - 'operation_id': 'v1_admin_user_uid_disclaimer_delete', - 'http_method': 'DELETE', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_user_uid_disclaimer_get_endpoint = _Endpoint( - settings={ - 'response_type': (Disclaimer,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/disclaimer', - 'operation_id': 'v1_admin_user_uid_disclaimer_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_user_uid_disclaimer_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/disclaimer/update', - 'operation_id': 'v1_admin_user_uid_disclaimer_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'payload', - ], - 'required': [ - 'session_token', - 'uid', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'payload': - (StringId,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_user_uid_features_get_endpoint = _Endpoint( - settings={ - 'response_type': (FeatureList,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/features', - 'operation_id': 'v1_admin_user_uid_features_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_user_uid_features_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/features/update', - 'operation_id': 'v1_admin_user_uid_features_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'payload', - ], - 'required': [ - 'session_token', - 'uid', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'payload': - (FeatureList,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_user_uid_roles_add_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/roles/add', - 'operation_id': 'v1_admin_user_uid_roles_add_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'payload', - ], - 'required': [ - 'session_token', - 'uid', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'payload': - (StringId,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_user_uid_roles_remove_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/roles/remove', - 'operation_id': 'v1_admin_user_uid_roles_remove_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'payload', - ], - 'required': [ - 'session_token', - 'uid', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'payload': - (StringId,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_user_uid_status_get_endpoint = _Endpoint( - settings={ - 'response_type': (UserStatus,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/status', - 'operation_id': 'v1_admin_user_uid_status_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_admin_user_uid_status_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{uid}/status/update', - 'operation_id': 'v1_admin_user_uid_status_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'payload', - ], - 'required': [ - 'session_token', - 'uid', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'payload': - (UserStatus,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_admin_user_user_id_suspension_update_put_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/admin/user/{userId}/suspension/update', - 'operation_id': 'v1_admin_user_user_id_suspension_update_put', - 'http_method': 'PUT', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'user_id', - 'payload', - ], - 'required': [ - 'session_token', - 'user_id', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'user_id': - (int,), - 'payload': - (UserSuspension,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'user_id': 'userId', - }, - 'location_map': { - 'session_token': 'header', - 'user_id': 'path', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_user_manifest_own_get_endpoint = _Endpoint( - settings={ - 'response_type': (ServiceAccountManifest,), - 'auth': [], - 'endpoint_path': '/v1/user/manifest/own', - 'operation_id': 'v1_user_manifest_own_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_user_manifest_own_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/user/manifest/own', - 'operation_id': 'v1_user_manifest_own_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'manifest', - ], - 'required': [ - 'session_token', - 'manifest', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'manifest': - (ServiceAccountManifest,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'manifest': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_user_uid_follow_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/user/{uid}/follow', - 'operation_id': 'v1_user_uid_follow_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'uid_list', - ], - 'required': [ - 'session_token', - 'uid', - 'uid_list', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'uid_list': - (FollowersList,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'uid_list': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_user_uid_followers_get_endpoint = _Endpoint( - settings={ - 'response_type': (FollowersListResponse,), - 'auth': [], - 'endpoint_path': '/v1/user/{uid}/followers', - 'operation_id': 'v1_user_uid_followers_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'limit', - 'before', - 'after', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'limit': - (int,), - 'before': - (str,), - 'after': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - 'limit': 'limit', - 'before': 'before', - 'after': 'after', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'limit': 'query', - 'before': 'query', - 'after': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_user_uid_following_get_endpoint = _Endpoint( - settings={ - 'response_type': (FollowingListResponse,), - 'auth': [], - 'endpoint_path': '/v1/user/{uid}/following', - 'operation_id': 'v1_user_uid_following_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'limit', - 'before', - 'after', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'limit': - (int,), - 'before': - (str,), - 'after': - (str,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - 'limit': 'limit', - 'before': 'before', - 'after': 'after', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'limit': 'query', - 'before': 'query', - 'after': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_user_uid_unfollow_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/user/{uid}/unfollow', - 'operation_id': 'v1_user_uid_unfollow_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'uid_list', - ], - 'required': [ - 'session_token', - 'uid', - 'uid_list', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'uid_list': - (FollowersList,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'uid_list': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v2_admin_user_create_post_endpoint = _Endpoint( - settings={ - 'response_type': (V2UserDetail,), - 'auth': [], - 'endpoint_path': '/v2/admin/user/create', - 'operation_id': 'v2_admin_user_create_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'payload', - ], - 'required': [ - 'session_token', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'payload': - (V2UserCreate,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - }, - 'location_map': { - 'session_token': 'header', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v2_admin_user_list_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2UserDetailList,), - 'auth': [], - 'endpoint_path': '/v2/admin/user/list', - 'operation_id': 'v2_admin_user_list_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'skip', - 'limit', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'skip': - (int,), - 'limit': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - }, - 'location_map': { - 'session_token': 'header', - 'skip': 'query', - 'limit': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v2_admin_user_uid_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2UserDetail,), - 'auth': [], - 'endpoint_path': '/v2/admin/user/{uid}', - 'operation_id': 'v2_admin_user_uid_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - ], - 'required': [ - 'session_token', - 'uid', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v2_admin_user_uid_update_post_endpoint = _Endpoint( - settings={ - 'response_type': (V2UserDetail,), - 'auth': [], - 'endpoint_path': '/v2/admin/user/{uid}/update', - 'operation_id': 'v2_admin_user_uid_update_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'payload', - ], - 'required': [ - 'session_token', - 'uid', - 'payload', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'payload': - (V2UserAttributes,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'path', - 'payload': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ + + + @validate_call + async def v1_admin_system_roles_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[RoleDetail]: + """Get a list of all roles available in the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_roles_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[RoleDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_system_roles_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[RoleDetail]]: + """Get a list of all roles available in the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_roles_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[RoleDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_system_roles_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get a list of all roles available in the company (pod) + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_system_roles_list_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[RoleDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_system_roles_list_get_serialize( + self, + session_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ 'application/json' ] - }, - api_client=api_client + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/system/roles/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth ) - def v1_admin_system_roles_list_get( + + + + @validate_call + async def v1_admin_user_find_post( self, - session_token, - **kwargs - ): - """Get a list of all roles available in the company (pod) # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_system_roles_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - RoleDetailList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_admin_system_roles_list_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_find_post( + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserFilter, + skip: Annotated[Optional[StrictInt], Field(description="Number of users to skip. Default is 0. Must be a integer equals or bigger than 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[UserDetail]: + """Find a user based on attributes + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserFilter + :param skip: Number of users to skip. Default is 0. Must be a integer equals or bigger than 0. + :type skip: int + :param limit: Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_find_post_serialize( + session_token=session_token, + payload=payload, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_find_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserFilter, + skip: Annotated[Optional[StrictInt], Field(description="Number of users to skip. Default is 0. Must be a integer equals or bigger than 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[UserDetail]]: + """Find a user based on attributes + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserFilter + :param skip: Number of users to skip. Default is 0. Must be a integer equals or bigger than 0. + :type skip: int + :param limit: Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_find_post_serialize( + session_token=session_token, + payload=payload, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_find_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: UserFilter, + skip: Annotated[Optional[StrictInt], Field(description="Number of users to skip. Default is 0. Must be a integer equals or bigger than 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Find a user based on attributes + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: UserFilter + :param skip: Number of users to skip. Default is 0. Must be a integer equals or bigger than 0. + :type skip: int + :param limit: Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_find_post_serialize( + session_token=session_token, + payload=payload, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[UserDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_find_post_serialize( self, session_token, payload, - **kwargs - ): - """Find a user based on attributes # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_find_post(session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - payload (UserFilter): - - Keyword Args: - skip (int): Number of users to skip. Default is 0. Must be a integer equals or bigger than 0.. [optional] - limit (int): Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserDetailList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v1_admin_user_find_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_avatar_get( + skip, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/user/find', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_avatar_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[Avatar]: + """Get the URL of the avatar of a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_avatar_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Avatar]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_avatar_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[Avatar]]: + """Get the URL of the avatar of a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_avatar_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Avatar]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_avatar_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the URL of the avatar of a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_avatar_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Avatar]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_avatar_get_serialize( self, session_token, uid, - **kwargs - ): - """Get the URL of the avatar of a particular user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_avatar_get(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - AvatarList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v1_admin_user_uid_avatar_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_avatar_update_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/user/{uid}/avatar', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_avatar_update_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: AvatarUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Update the avatar of a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: AvatarUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_avatar_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_avatar_update_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: AvatarUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Update the avatar of a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: AvatarUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_avatar_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_avatar_update_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: AvatarUpdate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the avatar of a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: AvatarUpdate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_avatar_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_avatar_update_post_serialize( self, session_token, uid, payload, - **kwargs - ): - """Update the avatar of a particular user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_avatar_update_post(session_token, uid, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - payload (AvatarUpdate): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['payload'] = \ - payload - return self.v1_admin_user_uid_avatar_update_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_delegates_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/user/{uid}/avatar/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_delegates_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[int]: + """Get the delegates assigned to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_delegates_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[int]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_delegates_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[int]]: + """Get the delegates assigned to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_delegates_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[int]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_delegates_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the delegates assigned to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_delegates_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[int]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_delegates_get_serialize( self, session_token, uid, - **kwargs - ): - """Get the delegates assigned to a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_delegates_get(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - IntegerList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v1_admin_user_uid_delegates_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_delegates_update_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/user/{uid}/delegates', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_delegates_update_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: DelegateAction, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Update the delegates assigned to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: DelegateAction + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_delegates_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_delegates_update_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: DelegateAction, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Update the delegates assigned to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: DelegateAction + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_delegates_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_delegates_update_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: DelegateAction, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the delegates assigned to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: DelegateAction + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_delegates_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_delegates_update_post_serialize( self, session_token, uid, payload, - **kwargs - ): - """Update the delegates assigned to a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_delegates_update_post(session_token, uid, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - payload (DelegateAction): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['payload'] = \ - payload - return self.v1_admin_user_uid_delegates_update_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_disclaimer_delete( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/user/{uid}/delegates/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_disclaimer_delete( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Unassign a disclaimer from a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_disclaimer_delete_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_disclaimer_delete_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Unassign a disclaimer from a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_disclaimer_delete_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_disclaimer_delete_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Unassign a disclaimer from a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_disclaimer_delete_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_disclaimer_delete_serialize( self, session_token, uid, - **kwargs - ): - """Unassign a disclaimer from a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_disclaimer_delete(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v1_admin_user_uid_disclaimer_delete_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_disclaimer_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v1/admin/user/{uid}/disclaimer', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_disclaimer_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Disclaimer: + """Get the disclaimer assigned to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_disclaimer_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Disclaimer", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_disclaimer_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Disclaimer]: + """Get the disclaimer assigned to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_disclaimer_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Disclaimer", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_disclaimer_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the disclaimer assigned to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_disclaimer_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Disclaimer", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_disclaimer_get_serialize( self, session_token, uid, - **kwargs - ): - """Get the disclaimer assigned to a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_disclaimer_get(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - Disclaimer - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v1_admin_user_uid_disclaimer_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_disclaimer_update_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/user/{uid}/disclaimer', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_disclaimer_update_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Assign a disclaimer to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_disclaimer_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_disclaimer_update_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Assign a disclaimer to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_disclaimer_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_disclaimer_update_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Assign a disclaimer to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_disclaimer_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_disclaimer_update_post_serialize( self, session_token, uid, payload, - **kwargs - ): - """Assign a disclaimer to a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_disclaimer_update_post(session_token, uid, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - payload (StringId): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['payload'] = \ - payload - return self.v1_admin_user_uid_disclaimer_update_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_features_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/user/{uid}/disclaimer/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_features_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[Feature]: + """Get the list of Symphony feature entitlements enabled for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_features_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Feature]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_features_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[Feature]]: + """Get the list of Symphony feature entitlements enabled for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_features_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Feature]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_features_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the list of Symphony feature entitlements enabled for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_features_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[Feature]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_features_get_serialize( self, session_token, uid, - **kwargs - ): - """Get the list of Symphony feature entitlements enabled for a particular user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_features_get(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - FeatureList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v1_admin_user_uid_features_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_features_update_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/user/{uid}/features', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_features_update_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: List[Feature], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Update the list of Symphony feature entitlements for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: List[Feature] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_features_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_features_update_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: List[Feature], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Update the list of Symphony feature entitlements for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: List[Feature] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_features_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_features_update_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: List[Feature], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the list of Symphony feature entitlements for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: List[Feature] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_features_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_features_update_post_serialize( self, session_token, uid, payload, - **kwargs - ): - """Update the list of Symphony feature entitlements for a particular user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_features_update_post(session_token, uid, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - payload (FeatureList): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['payload'] = \ - payload - return self.v1_admin_user_uid_features_update_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_roles_add_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'payload': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/user/{uid}/features/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_roles_add_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Add a role to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_roles_add_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_roles_add_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Add a role to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_roles_add_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_roles_add_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Add a role to a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_roles_add_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_roles_add_post_serialize( self, session_token, uid, payload, - **kwargs - ): - """Add a role to a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_roles_add_post(session_token, uid, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - payload (StringId): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['payload'] = \ - payload - return self.v1_admin_user_uid_roles_add_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_roles_remove_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/user/{uid}/roles/add', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_roles_remove_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Remove a role from a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_roles_remove_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_roles_remove_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Remove a role from a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_roles_remove_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_roles_remove_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: StringId, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Remove a role from a user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: StringId + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_roles_remove_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_roles_remove_post_serialize( self, session_token, uid, payload, - **kwargs - ): - """Remove a role from a user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_roles_remove_post(session_token, uid, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - payload (StringId): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['payload'] = \ - payload - return self.v1_admin_user_uid_roles_remove_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_status_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/user/{uid}/roles/remove', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_status_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserStatus: + """Get the status, active or inactive, for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_status_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserStatus", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_status_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserStatus]: + """Get the status, active or inactive, for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_status_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserStatus", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_status_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get the status, active or inactive, for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_status_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserStatus", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_status_get_serialize( self, session_token, uid, - **kwargs - ): - """Get the status, active or inactive, for a particular user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_status_get(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserStatus - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v1_admin_user_uid_status_get_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_uid_status_update_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/admin/user/{uid}/status', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_uid_status_update_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: UserStatus, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Update the status of a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: UserStatus + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_status_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_uid_status_update_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: UserStatus, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Update the status of a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: UserStatus + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_status_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_uid_status_update_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: UserStatus, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the status of a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: UserStatus + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_uid_status_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_uid_status_update_post_serialize( self, session_token, uid, payload, - **kwargs - ): - """Update the status of a particular user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_uid_status_update_post(session_token, uid, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - payload (UserStatus): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['payload'] = \ - payload - return self.v1_admin_user_uid_status_update_post_endpoint.call_with_http_info(**kwargs) - - def v1_admin_user_user_id_suspension_update_put( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/admin/user/{uid}/status/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_admin_user_user_id_suspension_update_put( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token")], + user_id: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + payload: UserSuspension, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Update the status of suspension of a particular user + + + :param session_token: Session authentication token (required) + :type session_token: str + :param user_id: User ID as a decimal integer (required) + :type user_id: int + :param payload: (required) + :type payload: UserSuspension + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_user_id_suspension_update_put_serialize( + session_token=session_token, + user_id=user_id, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_admin_user_user_id_suspension_update_put_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token")], + user_id: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + payload: UserSuspension, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Update the status of suspension of a particular user + + + :param session_token: Session authentication token (required) + :type session_token: str + :param user_id: User ID as a decimal integer (required) + :type user_id: int + :param payload: (required) + :type payload: UserSuspension + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_user_id_suspension_update_put_serialize( + session_token=session_token, + user_id=user_id, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_admin_user_user_id_suspension_update_put_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token")], + user_id: Annotated[StrictInt, Field(description="User ID as a decimal integer")], + payload: UserSuspension, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update the status of suspension of a particular user + + + :param session_token: Session authentication token (required) + :type session_token: str + :param user_id: User ID as a decimal integer (required) + :type user_id: int + :param payload: (required) + :type payload: UserSuspension + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_admin_user_user_id_suspension_update_put_serialize( + session_token=session_token, + user_id=user_id, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_admin_user_user_id_suspension_update_put_serialize( self, session_token, user_id, payload, - **kwargs - ): - """Update the status of suspension of a particular user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_admin_user_user_id_suspension_update_put(session_token, user_id, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token - user_id (int): User ID as a decimal integer - payload (UserSuspension): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['user_id'] = \ - user_id - kwargs['payload'] = \ - payload - return self.v1_admin_user_user_id_suspension_update_put_endpoint.call_with_http_info(**kwargs) - - def v1_user_manifest_own_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if user_id is not None: + _path_params['userId'] = user_id + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/v1/admin/user/{userId}/suspension/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_user_manifest_own_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ServiceAccountManifest: + """Get own service account manifest + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_manifest_own_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServiceAccountManifest", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_user_manifest_own_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ServiceAccountManifest]: + """Get own service account manifest + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_manifest_own_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServiceAccountManifest", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_user_manifest_own_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get own service account manifest + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_manifest_own_get_serialize( + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ServiceAccountManifest", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_user_manifest_own_get_serialize( self, session_token, - **kwargs - ): - """Get own service account manifest # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_user_manifest_own_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - ServiceAccountManifest - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v1_user_manifest_own_get_endpoint.call_with_http_info(**kwargs) - - def v1_user_manifest_own_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/user/manifest/own', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_user_manifest_own_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + manifest: Annotated[ServiceAccountManifest, Field(description="Service Account Manifest to put in user account")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Update own service account manifest + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param manifest: Service Account Manifest to put in user account (required) + :type manifest: ServiceAccountManifest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_manifest_own_post_serialize( + session_token=session_token, + manifest=manifest, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_user_manifest_own_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + manifest: Annotated[ServiceAccountManifest, Field(description="Service Account Manifest to put in user account")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Update own service account manifest + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param manifest: Service Account Manifest to put in user account (required) + :type manifest: ServiceAccountManifest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_manifest_own_post_serialize( + session_token=session_token, + manifest=manifest, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_user_manifest_own_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + manifest: Annotated[ServiceAccountManifest, Field(description="Service Account Manifest to put in user account")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update own service account manifest + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param manifest: Service Account Manifest to put in user account (required) + :type manifest: ServiceAccountManifest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_manifest_own_post_serialize( + session_token=session_token, + manifest=manifest, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_user_manifest_own_post_serialize( self, session_token, manifest, - **kwargs - ): - """Update own service account manifest # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_user_manifest_own_post(session_token, manifest, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - manifest (ServiceAccountManifest): Service Account Manifest to put in user account - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['manifest'] = \ - manifest - return self.v1_user_manifest_own_post_endpoint.call_with_http_info(**kwargs) - - def v1_user_uid_follow_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if manifest is not None: + _body_params = manifest + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/user/manifest/own', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_user_uid_follow_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user to be followed")], + uid_list: Annotated[FollowersList, Field(description="List of (integer) User IDs of the followers")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Make a list of users start following a specific user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user to be followed (required) + :type uid: int + :param uid_list: List of (integer) User IDs of the followers (required) + :type uid_list: FollowersList + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_follow_post_serialize( + session_token=session_token, + uid=uid, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_user_uid_follow_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user to be followed")], + uid_list: Annotated[FollowersList, Field(description="List of (integer) User IDs of the followers")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Make a list of users start following a specific user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user to be followed (required) + :type uid: int + :param uid_list: List of (integer) User IDs of the followers (required) + :type uid_list: FollowersList + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_follow_post_serialize( + session_token=session_token, + uid=uid, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_user_uid_follow_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user to be followed")], + uid_list: Annotated[FollowersList, Field(description="List of (integer) User IDs of the followers")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Make a list of users start following a specific user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user to be followed (required) + :type uid: int + :param uid_list: List of (integer) User IDs of the followers (required) + :type uid_list: FollowersList + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_follow_post_serialize( + session_token=session_token, + uid=uid, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_user_uid_follow_post_serialize( self, session_token, uid, uid_list, - **kwargs - ): - """Make a list of users start following a specific user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_user_uid_follow_post(session_token, uid, uid_list, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer of the user to be followed - uid_list (FollowersList): List of (integer) User IDs of the followers - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['uid_list'] = \ - uid_list - return self.v1_user_uid_follow_post_endpoint.call_with_http_info(**kwargs) - - def v1_user_uid_followers_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if uid_list is not None: + _body_params = uid_list + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/user/{uid}/follow', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_user_uid_followers_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user we want to get the followers list")], + limit: Annotated[Optional[StrictInt], Field(description="This is the maximum number of objects that may be returned.")] = None, + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “after” cursor value as presented via a response cursor.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FollowersListResponse: + """Returns the list of followers for a specific user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user we want to get the followers list (required) + :type uid: int + :param limit: This is the maximum number of objects that may be returned. + :type limit: int + :param before: Returns results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Returns results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_followers_get_serialize( + session_token=session_token, + uid=uid, + limit=limit, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FollowersListResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_user_uid_followers_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user we want to get the followers list")], + limit: Annotated[Optional[StrictInt], Field(description="This is the maximum number of objects that may be returned.")] = None, + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “after” cursor value as presented via a response cursor.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FollowersListResponse]: + """Returns the list of followers for a specific user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user we want to get the followers list (required) + :type uid: int + :param limit: This is the maximum number of objects that may be returned. + :type limit: int + :param before: Returns results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Returns results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_followers_get_serialize( + session_token=session_token, + uid=uid, + limit=limit, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FollowersListResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_user_uid_followers_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user we want to get the followers list")], + limit: Annotated[Optional[StrictInt], Field(description="This is the maximum number of objects that may be returned.")] = None, + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “after” cursor value as presented via a response cursor.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Returns the list of followers for a specific user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user we want to get the followers list (required) + :type uid: int + :param limit: This is the maximum number of objects that may be returned. + :type limit: int + :param before: Returns results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Returns results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_followers_get_serialize( + session_token=session_token, + uid=uid, + limit=limit, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FollowersListResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_user_uid_followers_get_serialize( self, session_token, uid, - **kwargs - ): - """Returns the list of followers for a specific user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_user_uid_followers_get(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer of the user we want to get the followers list - - Keyword Args: - limit (int): This is the maximum number of objects that may be returned.. [optional] - before (str): Returns results from an opaque “before” cursor value as presented via a response cursor.. [optional] - after (str): Returns results from an opaque “after” cursor value as presented via a response cursor.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - FollowersListResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v1_user_uid_followers_get_endpoint.call_with_http_info(**kwargs) - - def v1_user_uid_following_get( + limit, + before, + after, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if before is not None: + + _query_params.append(('before', before)) + + if after is not None: + + _query_params.append(('after', after)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/user/{uid}/followers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_user_uid_following_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user we want to get the following list")], + limit: Annotated[Optional[StrictInt], Field(description="This is the maximum number of objects that may be returned.")] = None, + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “after” cursor value as presented via a response cursor.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FollowingListResponse: + """Returns the list of users that a specific user is following + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user we want to get the following list (required) + :type uid: int + :param limit: This is the maximum number of objects that may be returned. + :type limit: int + :param before: Returns results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Returns results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_following_get_serialize( + session_token=session_token, + uid=uid, + limit=limit, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FollowingListResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_user_uid_following_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user we want to get the following list")], + limit: Annotated[Optional[StrictInt], Field(description="This is the maximum number of objects that may be returned.")] = None, + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “after” cursor value as presented via a response cursor.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FollowingListResponse]: + """Returns the list of users that a specific user is following + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user we want to get the following list (required) + :type uid: int + :param limit: This is the maximum number of objects that may be returned. + :type limit: int + :param before: Returns results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Returns results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_following_get_serialize( + session_token=session_token, + uid=uid, + limit=limit, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FollowingListResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_user_uid_following_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user we want to get the following list")], + limit: Annotated[Optional[StrictInt], Field(description="This is the maximum number of objects that may be returned.")] = None, + before: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “before” cursor value as presented via a response cursor.")] = None, + after: Annotated[Optional[StrictStr], Field(description="Returns results from an opaque “after” cursor value as presented via a response cursor.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Returns the list of users that a specific user is following + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user we want to get the following list (required) + :type uid: int + :param limit: This is the maximum number of objects that may be returned. + :type limit: int + :param before: Returns results from an opaque “before” cursor value as presented via a response cursor. + :type before: str + :param after: Returns results from an opaque “after” cursor value as presented via a response cursor. + :type after: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_following_get_serialize( + session_token=session_token, + uid=uid, + limit=limit, + before=before, + after=after, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FollowingListResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_user_uid_following_get_serialize( self, session_token, uid, - **kwargs - ): - """Returns the list of users that a specific user is following # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_user_uid_following_get(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer of the user we want to get the following list - - Keyword Args: - limit (int): This is the maximum number of objects that may be returned.. [optional] - before (str): Returns results from an opaque “before” cursor value as presented via a response cursor.. [optional] - after (str): Returns results from an opaque “after” cursor value as presented via a response cursor.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - FollowingListResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v1_user_uid_following_get_endpoint.call_with_http_info(**kwargs) - - def v1_user_uid_unfollow_post( + limit, + before, + after, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + if limit is not None: + + _query_params.append(('limit', limit)) + + if before is not None: + + _query_params.append(('before', before)) + + if after is not None: + + _query_params.append(('after', after)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/user/{uid}/following', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_user_uid_unfollow_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user to be unfollowed")], + uid_list: Annotated[FollowersList, Field(description="List of (integer) User IDs of the followers")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Make a list of users unfollowing a specific user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user to be unfollowed (required) + :type uid: int + :param uid_list: List of (integer) User IDs of the followers (required) + :type uid_list: FollowersList + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_unfollow_post_serialize( + session_token=session_token, + uid=uid, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_user_uid_unfollow_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user to be unfollowed")], + uid_list: Annotated[FollowersList, Field(description="List of (integer) User IDs of the followers")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Make a list of users unfollowing a specific user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user to be unfollowed (required) + :type uid: int + :param uid_list: List of (integer) User IDs of the followers (required) + :type uid_list: FollowersList + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_unfollow_post_serialize( + session_token=session_token, + uid=uid, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_user_uid_unfollow_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer of the user to be unfollowed")], + uid_list: Annotated[FollowersList, Field(description="List of (integer) User IDs of the followers")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Make a list of users unfollowing a specific user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer of the user to be unfollowed (required) + :type uid: int + :param uid_list: List of (integer) User IDs of the followers (required) + :type uid_list: FollowersList + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_uid_unfollow_post_serialize( + session_token=session_token, + uid=uid, + uid_list=uid_list, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_user_uid_unfollow_post_serialize( self, session_token, uid, uid_list, - **kwargs - ): - """Make a list of users unfollowing a specific user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_user_uid_unfollow_post(session_token, uid, uid_list, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer of the user to be unfollowed - uid_list (FollowersList): List of (integer) User IDs of the followers - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['uid_list'] = \ - uid_list - return self.v1_user_uid_unfollow_post_endpoint.call_with_http_info(**kwargs) - - def v2_admin_user_create_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if uid_list is not None: + _body_params = uid_list + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/user/{uid}/unfollow', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_admin_user_create_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V2UserCreate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2UserDetail: + """Create a new V2 User + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V2UserCreate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_create_post_serialize( + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_admin_user_create_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V2UserCreate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2UserDetail]: + """Create a new V2 User + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V2UserCreate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_create_post_serialize( + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_admin_user_create_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + payload: V2UserCreate, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a new V2 User + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param payload: (required) + :type payload: V2UserCreate + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_create_post_serialize( + session_token=session_token, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_admin_user_create_post_serialize( self, session_token, payload, - **kwargs - ): - """Create a new V2 User # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_admin_user_create_post(session_token, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - payload (V2UserCreate): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2UserDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['payload'] = \ - payload - return self.v2_admin_user_create_post_endpoint.call_with_http_info(**kwargs) - - def v2_admin_user_list_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v2/admin/user/create', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_admin_user_list_get( + self, + session_token: Annotated[StrictStr, Field(description="Session Authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of users to skip. Default is 0. Must be a integer equals or bigger than 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> List[V2UserDetail]: + """Retrieve a list of all users in the company (pod) + + + :param session_token: Session Authentication token. (required) + :type session_token: str + :param skip: Number of users to skip. Default is 0. Must be a integer equals or bigger than 0. + :type skip: int + :param limit: Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_list_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2UserDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_admin_user_list_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session Authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of users to skip. Default is 0. Must be a integer equals or bigger than 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[List[V2UserDetail]]: + """Retrieve a list of all users in the company (pod) + + + :param session_token: Session Authentication token. (required) + :type session_token: str + :param skip: Number of users to skip. Default is 0. Must be a integer equals or bigger than 0. + :type skip: int + :param limit: Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_list_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2UserDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_admin_user_list_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session Authentication token.")], + skip: Annotated[Optional[StrictInt], Field(description="Number of users to skip. Default is 0. Must be a integer equals or bigger than 0.")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve a list of all users in the company (pod) + + + :param session_token: Session Authentication token. (required) + :type session_token: str + :param skip: Number of users to skip. Default is 0. Must be a integer equals or bigger than 0. + :type skip: int + :param limit: Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000. + :type limit: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_list_get_serialize( + session_token=session_token, + skip=skip, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "List[V2UserDetail]", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_admin_user_list_get_serialize( self, session_token, - **kwargs - ): - """Retrieve a list of all users in the company (pod) # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_admin_user_list_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session Authentication token. - - Keyword Args: - skip (int): Number of users to skip. Default is 0. Must be a integer equals or bigger than 0.. [optional] - limit (int): Maximum number of users to return. Default is 100. Must be a positive integer and must not exceed 1000.. [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2UserDetailList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v2_admin_user_list_get_endpoint.call_with_http_info(**kwargs) - - def v2_admin_user_uid_get( + skip, + limit, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/admin/user/list', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_admin_user_uid_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2UserDetail: + """Retrieve V2 User details for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_uid_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_admin_user_uid_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2UserDetail]: + """Retrieve V2 User details for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_uid_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_admin_user_uid_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve V2 User details for a particular user + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_uid_get_serialize( + session_token=session_token, + uid=uid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_admin_user_uid_get_serialize( self, session_token, uid, - **kwargs - ): - """Retrieve V2 User details for a particular user # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_admin_user_uid_get(session_token, uid, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2UserDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - return self.v2_admin_user_uid_get_endpoint.call_with_http_info(**kwargs) - - def v2_admin_user_uid_update_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/admin/user/{uid}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_admin_user_uid_update_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: V2UserAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2UserDetail: + """Update an existing V2 User + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: V2UserAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_uid_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_admin_user_uid_update_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: V2UserAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2UserDetail]: + """Update an existing V2 User + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: V2UserAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_uid_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_admin_user_uid_update_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[StrictInt, Field(description="User ID as a decimal integer ")], + payload: V2UserAttributes, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update an existing V2 User + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer (required) + :type uid: int + :param payload: (required) + :type payload: V2UserAttributes + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_admin_user_uid_update_post_serialize( + session_token=session_token, + uid=uid, + payload=payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserDetail", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_admin_user_uid_update_post_serialize( self, session_token, uid, payload, - **kwargs - ): - """Update an existing V2 User # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_admin_user_uid_update_post(session_token, uid, payload, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - uid (int): User ID as a decimal integer - payload (V2UserAttributes): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2UserDetail - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['uid'] = \ - uid - kwargs['payload'] = \ - payload - return self.v2_admin_user_uid_update_post_endpoint.call_with_http_info(**kwargs) + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if payload is not None: + _body_params = payload + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v2/admin/user/{uid}/update', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_api/users_api.py b/symphony/bdk/gen/pod_api/users_api.py index 8898d81a..5eb2cb9d 100644 --- a/symphony/bdk/gen/pod_api/users_api.py +++ b/symphony/bdk/gen/pod_api/users_api.py @@ -1,27 +1,24 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 - -from symphony.bdk.gen.api_client import ApiClient, Endpoint as _Endpoint -from symphony.bdk.gen.model_utils import ( # noqa: F401 - check_allowed_values, - check_validations, - date, - datetime, - file_type, - none_type, - validate_and_convert_types -) -from symphony.bdk.gen.pod_model.error import Error +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictBool, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.success_response import SuccessResponse from symphony.bdk.gen.pod_model.user_search_query import UserSearchQuery from symphony.bdk.gen.pod_model.user_search_results import UserSearchResults @@ -29,895 +26,1937 @@ from symphony.bdk.gen.pod_model.v1_user_sessions import V1UserSessions from symphony.bdk.gen.pod_model.v2_user_list import V2UserList +from symphony.bdk.gen.api_client import ApiClient, RequestSerialized +from symphony.bdk.gen.api_response import ApiResponse +from symphony.bdk.gen.rest import RESTResponseType + -class UsersApi(object): +class UsersApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None): + def __init__(self, api_client=None) -> None: if api_client is None: - api_client = ApiClient() + api_client = ApiClient.get_default() self.api_client = api_client - self.v1_user_search_post_endpoint = _Endpoint( - settings={ - 'response_type': (UserSearchResults,), - 'auth': [], - 'endpoint_path': '/v1/user/search', - 'operation_id': 'v1_user_search_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'search_request', - 'skip', - 'limit', - 'local', - ], - 'required': [ - 'session_token', - 'search_request', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'search_request': - (UserSearchQuery,), - 'skip': - (int,), - 'limit': - (int,), - 'local': - (bool,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'skip': 'skip', - 'limit': 'limit', - 'local': 'local', - }, - 'location_map': { - 'session_token': 'header', - 'search_request': 'body', - 'skip': 'query', - 'limit': 'query', - 'local': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) - self.v1_users_uid_sessions_get_endpoint = _Endpoint( - settings={ - 'response_type': (V1UserSessions,), - 'auth': [], - 'endpoint_path': '/v1/users/{uid}/sessions', - 'operation_id': 'v1_users_uid_sessions_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'uid', - 'session_token', - ], - 'required': [ - 'uid', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'uid': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'uid': 'uid', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'uid': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_users_uid_sessions_logout_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/users/{uid}/sessions/logout', - 'operation_id': 'v1_users_uid_sessions_logout_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'uid', - 'session_token', - ], - 'required': [ - 'uid', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'uid': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'uid': 'uid', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'uid': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v1_users_uid_sessions_sid_logout_post_endpoint = _Endpoint( - settings={ - 'response_type': (SuccessResponse,), - 'auth': [], - 'endpoint_path': '/v1/users/{uid}/sessions/{sid}/logout', - 'operation_id': 'v1_users_uid_sessions_sid_logout_post', - 'http_method': 'POST', - 'servers': None, - }, - params_map={ - 'all': [ - 'uid', - 'sid', - 'session_token', - ], - 'required': [ - 'uid', - 'sid', - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'uid': - (str,), - 'sid': - (str,), - 'session_token': - (str,), - }, - 'attribute_map': { - 'uid': 'uid', - 'sid': 'sid', - 'session_token': 'sessionToken', - }, - 'location_map': { - 'uid': 'path', - 'sid': 'path', - 'session_token': 'header', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v2_user_get_endpoint = _Endpoint( - settings={ - 'response_type': (UserV2,), - 'auth': [], - 'endpoint_path': '/v2/user', - 'operation_id': 'v2_user_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'email', - 'username', - 'local', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (int,), - 'email': - (str,), - 'username': - (str,), - 'local': - (bool,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - 'email': 'email', - 'username': 'username', - 'local': 'local', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'query', - 'email': 'query', - 'username': 'query', - 'local': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client - ) - self.v3_users_get_endpoint = _Endpoint( - settings={ - 'response_type': (V2UserList,), - 'auth': [], - 'endpoint_path': '/v3/users', - 'operation_id': 'v3_users_get', - 'http_method': 'GET', - 'servers': None, - }, - params_map={ - 'all': [ - 'session_token', - 'uid', - 'email', - 'username', - 'local', - 'active', - ], - 'required': [ - 'session_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'session_token': - (str,), - 'uid': - (str,), - 'email': - (str,), - 'username': - (str,), - 'local': - (bool,), - 'active': - (bool,), - }, - 'attribute_map': { - 'session_token': 'sessionToken', - 'uid': 'uid', - 'email': 'email', - 'username': 'username', - 'local': 'local', - 'active': 'active', - }, - 'location_map': { - 'session_token': 'header', - 'uid': 'query', - 'email': 'query', - 'username': 'query', - 'local': 'query', - 'active': 'query', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [], - }, - api_client=api_client + + + @validate_call + async def v1_user_search_post( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + search_request: Annotated[UserSearchQuery, Field(description="search criteria")], + skip: Annotated[Optional[StrictInt], Field(description="number of records to skip")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max number of records to return. If no value is provided, 50 is the default.")] = None, + local: Annotated[Optional[StrictBool], Field(description="If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserSearchResults: + """Search for users by name or email address + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param search_request: search criteria (required) + :type search_request: UserSearchQuery + :param skip: number of records to skip + :type skip: int + :param limit: Max number of records to return. If no value is provided, 50 is the default. + :type limit: int + :param local: If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. + :type local: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_search_post_serialize( + session_token=session_token, + search_request=search_request, + skip=skip, + limit=limit, + local=local, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserSearchResults", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data - def v1_user_search_post( + + @validate_call + async def v1_user_search_post_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + search_request: Annotated[UserSearchQuery, Field(description="search criteria")], + skip: Annotated[Optional[StrictInt], Field(description="number of records to skip")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max number of records to return. If no value is provided, 50 is the default.")] = None, + local: Annotated[Optional[StrictBool], Field(description="If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserSearchResults]: + """Search for users by name or email address + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param search_request: search criteria (required) + :type search_request: UserSearchQuery + :param skip: number of records to skip + :type skip: int + :param limit: Max number of records to return. If no value is provided, 50 is the default. + :type limit: int + :param local: If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. + :type local: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_search_post_serialize( + session_token=session_token, + search_request=search_request, + skip=skip, + limit=limit, + local=local, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserSearchResults", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_user_search_post_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + search_request: Annotated[UserSearchQuery, Field(description="search criteria")], + skip: Annotated[Optional[StrictInt], Field(description="number of records to skip")] = None, + limit: Annotated[Optional[StrictInt], Field(description="Max number of records to return. If no value is provided, 50 is the default.")] = None, + local: Annotated[Optional[StrictBool], Field(description="If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Search for users by name or email address + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param search_request: search criteria (required) + :type search_request: UserSearchQuery + :param skip: number of records to skip + :type skip: int + :param limit: Max number of records to return. If no value is provided, 50 is the default. + :type limit: int + :param local: If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. + :type local: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_user_search_post_serialize( + session_token=session_token, + search_request=search_request, + skip=skip, + limit=limit, + local=local, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserSearchResults", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_user_search_post_serialize( self, session_token, search_request, - **kwargs - ): - """Search for users by name or email address # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_user_search_post(session_token, search_request, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - search_request (UserSearchQuery): search criteria - - Keyword Args: - skip (int): number of records to skip. [optional] - limit (int): Max number of records to return. If no value is provided, 50 is the default.. [optional] - local (bool): If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserSearchResults - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - kwargs['search_request'] = \ - search_request - return self.v1_user_search_post_endpoint.call_with_http_info(**kwargs) - - def v1_users_uid_sessions_get( + skip, + limit, + local, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if skip is not None: + + _query_params.append(('skip', skip)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if local is not None: + + _query_params.append(('local', local)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + if search_request is not None: + _body_params = search_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/user/search', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_users_uid_sessions_get( + self, + uid: Annotated[StrictStr, Field(description="The identifier of the user whose sessions are to be listed.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V1UserSessions: + """Lists all sessions for the user identified by {uid}. + + + :param uid: The identifier of the user whose sessions are to be listed. (required) + :type uid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_users_uid_sessions_get_serialize( + uid=uid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1UserSessions", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_users_uid_sessions_get_with_http_info( + self, + uid: Annotated[StrictStr, Field(description="The identifier of the user whose sessions are to be listed.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V1UserSessions]: + """Lists all sessions for the user identified by {uid}. + + + :param uid: The identifier of the user whose sessions are to be listed. (required) + :type uid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_users_uid_sessions_get_serialize( + uid=uid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1UserSessions", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_users_uid_sessions_get_without_preload_content( + self, + uid: Annotated[StrictStr, Field(description="The identifier of the user whose sessions are to be listed.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Lists all sessions for the user identified by {uid}. + + + :param uid: The identifier of the user whose sessions are to be listed. (required) + :type uid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_users_uid_sessions_get_serialize( + uid=uid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V1UserSessions", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_users_uid_sessions_get_serialize( self, uid, session_token, - **kwargs - ): - """Lists all sessions for the user identified by {uid}. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_users_uid_sessions_get(uid, session_token, async_req=True) - >>> result = thread.get() - - Args: - uid (str): The identifier of the user whose sessions are to be listed. - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V1UserSessions - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['uid'] = \ - uid - kwargs['session_token'] = \ - session_token - return self.v1_users_uid_sessions_get_endpoint.call_with_http_info(**kwargs) - - def v1_users_uid_sessions_logout_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/users/{uid}/sessions', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_users_uid_sessions_logout_post( + self, + uid: Annotated[StrictStr, Field(description="The identifier of the user whose sessions are to be terminated.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Ends all sessions for the user identified by {uid}. + + + :param uid: The identifier of the user whose sessions are to be terminated. (required) + :type uid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_users_uid_sessions_logout_post_serialize( + uid=uid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_users_uid_sessions_logout_post_with_http_info( + self, + uid: Annotated[StrictStr, Field(description="The identifier of the user whose sessions are to be terminated.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Ends all sessions for the user identified by {uid}. + + + :param uid: The identifier of the user whose sessions are to be terminated. (required) + :type uid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_users_uid_sessions_logout_post_serialize( + uid=uid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_users_uid_sessions_logout_post_without_preload_content( + self, + uid: Annotated[StrictStr, Field(description="The identifier of the user whose sessions are to be terminated.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Ends all sessions for the user identified by {uid}. + + + :param uid: The identifier of the user whose sessions are to be terminated. (required) + :type uid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_users_uid_sessions_logout_post_serialize( + uid=uid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_users_uid_sessions_logout_post_serialize( self, uid, session_token, - **kwargs - ): - """Ends all sessions for the user identified by {uid}. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_users_uid_sessions_logout_post(uid, session_token, async_req=True) - >>> result = thread.get() - - Args: - uid (str): The identifier of the user whose sessions are to be terminated. - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['uid'] = \ - uid - kwargs['session_token'] = \ - session_token - return self.v1_users_uid_sessions_logout_post_endpoint.call_with_http_info(**kwargs) - - def v1_users_uid_sessions_sid_logout_post( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/users/{uid}/sessions/logout', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v1_users_uid_sessions_sid_logout_post( + self, + uid: Annotated[StrictStr, Field(description="The identifier of the user who owns the session to be terminated.")], + sid: Annotated[StrictStr, Field(description="The identifier of the session to be terminated.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SuccessResponse: + """Ends the session identified by {sid} for the user with the identifier {uid}. + + + :param uid: The identifier of the user who owns the session to be terminated. (required) + :type uid: str + :param sid: The identifier of the session to be terminated. (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_users_uid_sessions_sid_logout_post_serialize( + uid=uid, + sid=sid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v1_users_uid_sessions_sid_logout_post_with_http_info( + self, + uid: Annotated[StrictStr, Field(description="The identifier of the user who owns the session to be terminated.")], + sid: Annotated[StrictStr, Field(description="The identifier of the session to be terminated.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SuccessResponse]: + """Ends the session identified by {sid} for the user with the identifier {uid}. + + + :param uid: The identifier of the user who owns the session to be terminated. (required) + :type uid: str + :param sid: The identifier of the session to be terminated. (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_users_uid_sessions_sid_logout_post_serialize( + uid=uid, + sid=sid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v1_users_uid_sessions_sid_logout_post_without_preload_content( + self, + uid: Annotated[StrictStr, Field(description="The identifier of the user who owns the session to be terminated.")], + sid: Annotated[StrictStr, Field(description="The identifier of the session to be terminated.")], + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Ends the session identified by {sid} for the user with the identifier {uid}. + + + :param uid: The identifier of the user who owns the session to be terminated. (required) + :type uid: str + :param sid: The identifier of the session to be terminated. (required) + :type sid: str + :param session_token: Session authentication token. (required) + :type session_token: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v1_users_uid_sessions_sid_logout_post_serialize( + uid=uid, + sid=sid, + session_token=session_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SuccessResponse", + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v1_users_uid_sessions_sid_logout_post_serialize( self, uid, sid, session_token, - **kwargs - ): - """Ends the session identified by {sid} for the user with the identifier {uid}. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v1_users_uid_sessions_sid_logout_post(uid, sid, session_token, async_req=True) - >>> result = thread.get() - - Args: - uid (str): The identifier of the user who owns the session to be terminated. - sid (str): The identifier of the session to be terminated. - session_token (str): Session authentication token. - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - SuccessResponse - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['uid'] = \ - uid - kwargs['sid'] = \ - sid - kwargs['session_token'] = \ - session_token - return self.v1_users_uid_sessions_sid_logout_post_endpoint.call_with_http_info(**kwargs) - - def v2_user_get( + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if uid is not None: + _path_params['uid'] = uid + if sid is not None: + _path_params['sid'] = sid + # process the query parameters + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/users/{uid}/sessions/{sid}/logout', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v2_user_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[Optional[StrictInt], Field(description="User ID as a decimal integer")] = None, + email: Annotated[Optional[StrictStr], Field(description="Email address")] = None, + username: Annotated[Optional[StrictStr], Field(description="login user name")] = None, + local: Annotated[Optional[StrictBool], Field(description="If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. Note: for username search, the local flag must be true ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UserV2: + """Get user information + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer + :type uid: int + :param email: Email address + :type email: str + :param username: login user name + :type username: str + :param local: If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. Note: for username search, the local flag must be true + :type local: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_user_get_serialize( + session_token=session_token, + uid=uid, + email=email, + username=username, + local=local, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserV2", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v2_user_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[Optional[StrictInt], Field(description="User ID as a decimal integer")] = None, + email: Annotated[Optional[StrictStr], Field(description="Email address")] = None, + username: Annotated[Optional[StrictStr], Field(description="login user name")] = None, + local: Annotated[Optional[StrictBool], Field(description="If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. Note: for username search, the local flag must be true ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UserV2]: + """Get user information + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer + :type uid: int + :param email: Email address + :type email: str + :param username: login user name + :type username: str + :param local: If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. Note: for username search, the local flag must be true + :type local: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_user_get_serialize( + session_token=session_token, + uid=uid, + email=email, + username=username, + local=local, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserV2", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v2_user_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[Optional[StrictInt], Field(description="User ID as a decimal integer")] = None, + email: Annotated[Optional[StrictStr], Field(description="Email address")] = None, + username: Annotated[Optional[StrictStr], Field(description="login user name")] = None, + local: Annotated[Optional[StrictBool], Field(description="If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. Note: for username search, the local flag must be true ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get user information + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User ID as a decimal integer + :type uid: int + :param email: Email address + :type email: str + :param username: login user name + :type username: str + :param local: If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. Note: for username search, the local flag must be true + :type local: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v2_user_get_serialize( + session_token=session_token, + uid=uid, + email=email, + username=username, + local=local, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UserV2", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v2_user_get_serialize( self, session_token, - **kwargs - ): - """Get user information # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v2_user_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - uid (int): User ID as a decimal integer. [optional] - email (str): Email address. [optional] - username (str): login user name. [optional] - local (bool): If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. Note: for username search, the local flag must be true . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - UserV2 - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v2_user_get_endpoint.call_with_http_info(**kwargs) - - def v3_users_get( + uid, + email, + username, + local, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if uid is not None: + + _query_params.append(('uid', uid)) + + if email is not None: + + _query_params.append(('email', email)) + + if username is not None: + + _query_params.append(('username', username)) + + if local is not None: + + _query_params.append(('local', local)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v2/user', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def v3_users_get( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[Optional[StrictStr], Field(description="User IDs as a list of decimal integers separated by comma")] = None, + email: Annotated[Optional[StrictStr], Field(description="List of email addresses separated by comma")] = None, + username: Annotated[Optional[StrictStr], Field(description="List of username separated by comma")] = None, + local: Annotated[Optional[StrictBool], Field(description="If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. ")] = None, + active: Annotated[Optional[StrictBool], Field(description="If not set all user status will be returned, if true all active users will be returned, if false all inactive users will be returned ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> V2UserList: + """Search users by emails or ids. Only one of the search lists should be informed at a time. Search lists may containt up to 100 elements. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User IDs as a list of decimal integers separated by comma + :type uid: str + :param email: List of email addresses separated by comma + :type email: str + :param username: List of username separated by comma + :type username: str + :param local: If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. + :type local: bool + :param active: If not set all user status will be returned, if true all active users will be returned, if false all inactive users will be returned + :type active: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_users_get_serialize( + session_token=session_token, + uid=uid, + email=email, + username=username, + local=local, + active=active, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserList", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def v3_users_get_with_http_info( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[Optional[StrictStr], Field(description="User IDs as a list of decimal integers separated by comma")] = None, + email: Annotated[Optional[StrictStr], Field(description="List of email addresses separated by comma")] = None, + username: Annotated[Optional[StrictStr], Field(description="List of username separated by comma")] = None, + local: Annotated[Optional[StrictBool], Field(description="If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. ")] = None, + active: Annotated[Optional[StrictBool], Field(description="If not set all user status will be returned, if true all active users will be returned, if false all inactive users will be returned ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[V2UserList]: + """Search users by emails or ids. Only one of the search lists should be informed at a time. Search lists may containt up to 100 elements. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User IDs as a list of decimal integers separated by comma + :type uid: str + :param email: List of email addresses separated by comma + :type email: str + :param username: List of username separated by comma + :type username: str + :param local: If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. + :type local: bool + :param active: If not set all user status will be returned, if true all active users will be returned, if false all inactive users will be returned + :type active: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_users_get_serialize( + session_token=session_token, + uid=uid, + email=email, + username=username, + local=local, + active=active, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserList", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def v3_users_get_without_preload_content( + self, + session_token: Annotated[StrictStr, Field(description="Session authentication token.")], + uid: Annotated[Optional[StrictStr], Field(description="User IDs as a list of decimal integers separated by comma")] = None, + email: Annotated[Optional[StrictStr], Field(description="List of email addresses separated by comma")] = None, + username: Annotated[Optional[StrictStr], Field(description="List of username separated by comma")] = None, + local: Annotated[Optional[StrictBool], Field(description="If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. ")] = None, + active: Annotated[Optional[StrictBool], Field(description="If not set all user status will be returned, if true all active users will be returned, if false all inactive users will be returned ")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Search users by emails or ids. Only one of the search lists should be informed at a time. Search lists may containt up to 100 elements. + + + :param session_token: Session authentication token. (required) + :type session_token: str + :param uid: User IDs as a list of decimal integers separated by comma + :type uid: str + :param email: List of email addresses separated by comma + :type email: str + :param username: List of username separated by comma + :type username: str + :param local: If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. + :type local: bool + :param active: If not set all user status will be returned, if true all active users will be returned, if false all inactive users will be returned + :type active: bool + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._v3_users_get_serialize( + session_token=session_token, + uid=uid, + email=email, + username=username, + local=local, + active=active, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "V2UserList", + '204': None, + '400': "Error", + '401': "Error", + '403': "Error", + '500': "Error", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_users_get_serialize( self, session_token, - **kwargs - ): - """Search users by emails or ids. Only one of the search lists should be informed at a time. Search lists may containt up to 100 elements. # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = pod_api.v3_users_get(session_token, async_req=True) - >>> result = thread.get() - - Args: - session_token (str): Session authentication token. - - Keyword Args: - uid (str): User IDs as a list of decimal integers separated by comma. [optional] - email (str): List of email addresses separated by comma. [optional] - username (str): List of username separated by comma. [optional] - local (bool): If true then a local DB search will be performed and only local pod users will be returned. If absent or false then a directory search will be performed and users from other pods who are visible to the calling user will also be returned. . [optional] - active (bool): If not set all user status will be returned, if true all active users will be returned, if false all inactive users will be returned . [optional] - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _content_type (str/None): force body content-type. - Default is None and content-type will be predicted by allowed - content-types and body. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - V2UserList - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_spec_property_naming'] = kwargs.get( - '_spec_property_naming', False - ) - kwargs['_content_type'] = kwargs.get( - '_content_type') - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['session_token'] = \ - session_token - return self.v3_users_get_endpoint.call_with_http_info(**kwargs) + uid, + email, + username, + local, + active, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if uid is not None: + + _query_params.append(('uid', uid)) + + if email is not None: + + _query_params.append(('email', email)) + + if username is not None: + + _query_params.append(('username', username)) + + if local is not None: + + _query_params.append(('local', local)) + + if active is not None: + + _query_params.append(('active', active)) + + # process the header parameters + if session_token is not None: + _header_params['sessionToken'] = session_token + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v3/users', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + diff --git a/symphony/bdk/gen/pod_model/__init__.py b/symphony/bdk/gen/pod_model/__init__.py deleted file mode 100644 index a14105e9..00000000 --- a/symphony/bdk/gen/pod_model/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# do not import all models into this module because that uses a lot of memory and stack frames diff --git a/symphony/bdk/gen/pod_model/admin_justified_action.py b/symphony/bdk/gen/pod_model/admin_justified_action.py index e15a3e85..01e7807e 100644 --- a/symphony/bdk/gen/pod_model/admin_justified_action.py +++ b/symphony/bdk/gen/pod_model/admin_justified_action.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AdminJustifiedAction(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'justification': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class AdminJustifiedAction(BaseModel): + """ + AdminJustifiedAction + """ # noqa: E501 + justification: Optional[StrictStr] = Field(default=None, description="The reason for the requested action.") + __properties: ClassVar[List[str]] = ["justification"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'justification': 'justification', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AdminJustifiedAction - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - justification (str): The reason for the requested action.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AdminJustifiedAction from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AdminJustifiedAction - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - justification (str): The reason for the requested action.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AdminJustifiedAction from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "justification": obj.get("justification") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.justification: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/admin_justified_user_action.py b/symphony/bdk/gen/pod_model/admin_justified_user_action.py index 7ede59aa..7d17cd6e 100644 --- a/symphony/bdk/gen/pod_model/admin_justified_user_action.py +++ b/symphony/bdk/gen/pod_model/admin_justified_user_action.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AdminJustifiedUserAction(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_id': (int, none_type), # noqa: E501 - 'justification': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class AdminJustifiedUserAction(BaseModel): + """ + AdminJustifiedUserAction + """ # noqa: E501 + user_id: Optional[StrictInt] = Field(default=None, description="The userId of the target user.", alias="userId") + justification: Optional[StrictStr] = Field(default=None, description="The reason for the requested action.") + __properties: ClassVar[List[str]] = ["userId", "justification"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'user_id': 'userId', # noqa: E501 - 'justification': 'justification', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AdminJustifiedUserAction - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): The userId of the target user.. [optional] # noqa: E501 - justification (str): The reason for the requested action.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AdminJustifiedUserAction from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AdminJustifiedUserAction - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): The userId of the target user.. [optional] # noqa: E501 - justification (str): The reason for the requested action.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AdminJustifiedUserAction from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "userId": obj.get("userId"), + "justification": obj.get("justification") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_id: int = None - self.justification: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/admin_stream_attributes.py b/symphony/bdk/gen/pod_model/admin_stream_attributes.py deleted file mode 100644 index 94476c4d..00000000 --- a/symphony/bdk/gen/pod_model/admin_stream_attributes.py +++ /dev/null @@ -1,199 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - - -class AdminStreamAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'room_name': (str, none_type), # noqa: E501 - 'room_description': (str, none_type), # noqa: E501 - 'members': ([int], none_type), # noqa: E501 - 'created_by_user_id': (int, none_type), # noqa: E501 - 'created_date': (int, none_type), # noqa: E501 - 'last_modified_date': (int, none_type), # noqa: E501 - 'origin_company': (str, none_type), # noqa: E501 - 'origin_company_id': (int, none_type), # noqa: E501 - 'members_count': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'room_name': 'roomName', # noqa: E501 - 'room_description': 'roomDescription', # noqa: E501 - 'members': 'members', # noqa: E501 - 'created_by_user_id': 'createdByUserId', # noqa: E501 - 'created_date': 'createdDate', # noqa: E501 - 'last_modified_date': 'lastModifiedDate', # noqa: E501 - 'origin_company': 'originCompany', # noqa: E501 - 'origin_company_id': 'originCompanyId', # noqa: E501 - 'members_count': 'membersCount', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AdminStreamAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - room_name (str): room name (room only). [optional] # noqa: E501 - room_description (str): description of the room (room only). [optional] # noqa: E501 - members ([int]): list of userid who is member of the stream - im or mim only. [optional] # noqa: E501 - created_by_user_id (int): creator user id. [optional] # noqa: E501 - created_date (int): created date. [optional] # noqa: E501 - last_modified_date (int): last modified date. [optional] # noqa: E501 - origin_company (str): company name of the creator. [optional] # noqa: E501 - origin_company_id (int): company id of the creator. [optional] # noqa: E501 - members_count (int): total number of members in the stream. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.room_name: str = None - self.room_description: str = None - self.members: List[int] = None - self.created_by_user_id: int = None - self.created_date: int = None - self.last_modified_date: int = None - self.origin_company: str = None - self.origin_company_id: int = None - self.members_count: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/admin_stream_filter.py b/symphony/bdk/gen/pod_model/admin_stream_filter.py deleted file mode 100644 index 87ca8978..00000000 --- a/symphony/bdk/gen/pod_model/admin_stream_filter.py +++ /dev/null @@ -1,210 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - -from symphony.bdk.gen.pod_model.admin_stream_type_enum import AdminStreamTypeEnum -globals()['AdminStreamTypeEnum'] = AdminStreamTypeEnum - - -class AdminStreamFilter(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('scope',): { - 'INTERNAL': "INTERNAL", - 'EXTERNAL': "EXTERNAL", - }, - ('origin',): { - 'INTERNAL': "INTERNAL", - 'EXTERNAL': "EXTERNAL", - }, - ('status',): { - 'ACTIVE': "ACTIVE", - 'INACTIVE': "INACTIVE", - }, - ('privacy',): { - 'PUBLIC': "PUBLIC", - 'PRIVATE': "PRIVATE", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream_types': ([AdminStreamTypeEnum], none_type), # noqa: E501 - 'scope': (str, none_type), # noqa: E501 - 'origin': (str, none_type), # noqa: E501 - 'status': (str, none_type), # noqa: E501 - 'privacy': (str, none_type), # noqa: E501 - 'start_date': (int, none_type), # noqa: E501 - 'end_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream_types': 'streamTypes', # noqa: E501 - 'scope': 'scope', # noqa: E501 - 'origin': 'origin', # noqa: E501 - 'status': 'status', # noqa: E501 - 'privacy': 'privacy', # noqa: E501 - 'start_date': 'startDate', # noqa: E501 - 'end_date': 'endDate', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AdminStreamFilter - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream_types ([AdminStreamTypeEnum]): type of streams to search for. [optional] # noqa: E501 - scope (str): scope of the room. If not specified, it will include both Internal and External scope. [optional] # noqa: E501 - origin (str): Origin of the room. It indicate whether the room was created by a user within the company by another company. If not specified, it will include both Internal and External origin. . [optional] # noqa: E501 - status (str): Status of the room. If not specified, it will include both Active and Inactive status. [optional] # noqa: E501 - privacy (str): Privacy setting of the stream. If not specified, it will include both public and private stream. [optional] # noqa: E501 - start_date (int): Start date in unix timestamp in millseconds. [optional] # noqa: E501 - end_date (int): End date in unix timestamp in millseconds. If not specified, it assume to be current time.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream_types: List[AdminStreamTypeEnum] = None - self.scope: str = None - self.origin: str = None - self.status: str = None - self.privacy: str = None - self.start_date: int = None - self.end_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/admin_stream_info.py b/symphony/bdk/gen/pod_model/admin_stream_info.py deleted file mode 100644 index 86ae9719..00000000 --- a/symphony/bdk/gen/pod_model/admin_stream_info.py +++ /dev/null @@ -1,190 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - -from symphony.bdk.gen.pod_model.admin_stream_attributes import AdminStreamAttributes -globals()['AdminStreamAttributes'] = AdminStreamAttributes - - -class AdminStreamInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'is_external': (bool, none_type), # noqa: E501 - 'is_active': (bool, none_type), # noqa: E501 - 'is_public': (bool, none_type), # noqa: E501 - 'type': (str, none_type), # noqa: E501 - 'attributes': (AdminStreamAttributes, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'is_external': 'isExternal', # noqa: E501 - 'is_active': 'isActive', # noqa: E501 - 'is_public': 'isPublic', # noqa: E501 - 'type': 'type', # noqa: E501 - 'attributes': 'attributes', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AdminStreamInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): stream id. [optional] # noqa: E501 - is_external (bool): true indicate this stream has the scope of external and false indictate this stream has the scope of internal. [optional] # noqa: E501 - is_active (bool): true indicate that this stream has the status of active and false indicate this stream has the scope of inactive. [optional] # noqa: E501 - is_public (bool): true indicate that this stream has a privacy setting of public. This only apply a ROOM stream type.. [optional] # noqa: E501 - type (str): type of stream (IM, MIM, ROOM). [optional] # noqa: E501 - attributes (AdminStreamAttributes): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.is_external: bool = None - self.is_active: bool = None - self.is_public: bool = None - self.type: str = None - self.attributes: AdminStreamAttributes = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/admin_stream_info_list.py b/symphony/bdk/gen/pod_model/admin_stream_info_list.py deleted file mode 100644 index 94e7a732..00000000 --- a/symphony/bdk/gen/pod_model/admin_stream_info_list.py +++ /dev/null @@ -1,183 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - -from symphony.bdk.gen.pod_model.admin_stream_info import AdminStreamInfo -globals()['AdminStreamInfo'] = AdminStreamInfo - - -class AdminStreamInfoList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([AdminStreamInfo],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """AdminStreamInfoList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([AdminStreamInfo]): list of stream info. # noqa: E501 - - Keyword Args: - value ([AdminStreamInfo]): list of stream info. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[AdminStreamInfo] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) diff --git a/symphony/bdk/gen/pod_model/admin_stream_list.py b/symphony/bdk/gen/pod_model/admin_stream_list.py deleted file mode 100644 index b0937f25..00000000 --- a/symphony/bdk/gen/pod_model/admin_stream_list.py +++ /dev/null @@ -1,188 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - -from symphony.bdk.gen.pod_model.admin_stream_filter import AdminStreamFilter -from symphony.bdk.gen.pod_model.admin_stream_info_list import AdminStreamInfoList -globals()['AdminStreamFilter'] = AdminStreamFilter -globals()['AdminStreamInfoList'] = AdminStreamInfoList - - -class AdminStreamList(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'count': (int, none_type), # noqa: E501 - 'skip': (int, none_type), # noqa: E501 - 'limit': (int, none_type), # noqa: E501 - 'filter': (AdminStreamFilter, none_type), # noqa: E501 - 'streams': (AdminStreamInfoList, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'count': 'count', # noqa: E501 - 'skip': 'skip', # noqa: E501 - 'limit': 'limit', # noqa: E501 - 'filter': 'filter', # noqa: E501 - 'streams': 'streams', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AdminStreamList - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): total number of streams which match the filter criteria. [optional] # noqa: E501 - skip (int): number of streams skipped. [optional] # noqa: E501 - limit (int): maximum number of streams return. [optional] # noqa: E501 - filter (AdminStreamFilter): [optional] # noqa: E501 - streams (AdminStreamInfoList): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.count: int = None - self.skip: int = None - self.limit: int = None - self.filter: AdminStreamFilter = None - self.streams: AdminStreamInfoList = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/admin_stream_type_enum.py b/symphony/bdk/gen/pod_model/admin_stream_type_enum.py deleted file mode 100644 index 411bfb5c..00000000 --- a/symphony/bdk/gen/pod_model/admin_stream_type_enum.py +++ /dev/null @@ -1,172 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - - -class AdminStreamTypeEnum(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('type',): { - 'IM': "IM", - 'MIM': "MIM", - 'ROOM': "ROOM", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'type': 'type', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AdminStreamTypeEnum - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/app_authentication_key.py b/symphony/bdk/gen/pod_model/app_authentication_key.py index 0f11ad01..870e5886 100644 --- a/symphony/bdk/gen/pod_model/app_authentication_key.py +++ b/symphony/bdk/gen/pod_model/app_authentication_key.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AppAuthenticationKey(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'key': (str, none_type), # noqa: E501 - 'expiration_date': (int, none_type), # noqa: E501 - 'action': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class AppAuthenticationKey(BaseModel): + """ + App RSA key information. + """ # noqa: E501 + key: Optional[StrictStr] = Field(default=None, description="Application RSA public key.") + expiration_date: Optional[StrictInt] = Field(default=None, description="RSA key expiration date. This value is set just for rotated keys.", alias="expirationDate") + action: Optional[StrictStr] = Field(default=None, description="Action to be performed on the RSA key. The following actions can be performed onto the app's active RSA key: - SAVE - REVOKE The following actions can be performed onto the app's rotated RSA key: - REVOKE - EXTEND ") + __properties: ClassVar[List[str]] = ["key", "expirationDate", "action"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'key': 'key', # noqa: E501 - 'expiration_date': 'expirationDate', # noqa: E501 - 'action': 'action', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AppAuthenticationKey - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - key (str): Application RSA public key.. [optional] # noqa: E501 - expiration_date (int): RSA key expiration date. This value is set just for rotated keys.. [optional] # noqa: E501 - action (str): Action to be performed on the RSA key. The following actions can be performed onto the app's active RSA key: - SAVE - REVOKE The following actions can be performed onto the app's rotated RSA key: - REVOKE - EXTEND . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AppAuthenticationKey from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AppAuthenticationKey - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - key (str): Application RSA public key.. [optional] # noqa: E501 - expiration_date (int): RSA key expiration date. This value is set just for rotated keys.. [optional] # noqa: E501 - action (str): Action to be performed on the RSA key. The following actions can be performed onto the app's active RSA key: - SAVE - REVOKE The following actions can be performed onto the app's rotated RSA key: - REVOKE - EXTEND . [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AppAuthenticationKey from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "key": obj.get("key"), + "expirationDate": obj.get("expirationDate"), + "action": obj.get("action") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.key: str = None - self.expiration_date: int = None - self.action: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/app_authentication_keys.py b/symphony/bdk/gen/pod_model/app_authentication_keys.py index 7eb93854..1b5edbca 100644 --- a/symphony/bdk/gen/pod_model/app_authentication_keys.py +++ b/symphony/bdk/gen/pod_model/app_authentication_keys.py @@ -1,264 +1,96 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.app_authentication_key import AppAuthenticationKey -globals()['AppAuthenticationKey'] = AppAuthenticationKey +from typing import Optional, Set +from typing_extensions import Self -class AppAuthenticationKeys(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class AppAuthenticationKeys(BaseModel): """ + App RSA keys information. + """ # noqa: E501 + current: Optional[AppAuthenticationKey] = None + previous: Optional[AppAuthenticationKey] = None + __properties: ClassVar[List[str]] = ["current", "previous"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'current': (AppAuthenticationKey, none_type), # noqa: E501 - 'previous': (AppAuthenticationKey, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'current': 'current', # noqa: E501 - 'previous': 'previous', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AppAuthenticationKeys - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - current (AppAuthenticationKey): [optional] # noqa: E501 - previous (AppAuthenticationKey): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AppAuthenticationKeys from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AppAuthenticationKeys - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - current (AppAuthenticationKey): [optional] # noqa: E501 - previous (AppAuthenticationKey): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of current + if self.current: + _dict['current'] = self.current.to_dict() + # override the default output from pydantic by calling `to_dict()` of previous + if self.previous: + _dict['previous'] = self.previous.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AppAuthenticationKeys from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "current": AppAuthenticationKey.from_dict(obj["current"]) if obj.get("current") is not None else None, + "previous": AppAuthenticationKey.from_dict(obj["previous"]) if obj.get("previous") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.current: AppAuthenticationKey = None - self.previous: AppAuthenticationKey = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/app_notification.py b/symphony/bdk/gen/pod_model/app_notification.py index f9b93255..dd200d9d 100644 --- a/symphony/bdk/gen/pod_model/app_notification.py +++ b/symphony/bdk/gen/pod_model/app_notification.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AppNotification(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'url': (str, none_type), # noqa: E501 - 'api_key': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class AppNotification(BaseModel): + """ + Application callback information + """ # noqa: E501 + url: Optional[StrictStr] = Field(default=None, description="callback URL") + api_key: Optional[StrictStr] = Field(default=None, description="apiKey sent into every callback request, using the X-API-KEY header", alias="apiKey") + __properties: ClassVar[List[str]] = ["url", "apiKey"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'url': 'url', # noqa: E501 - 'api_key': 'apiKey', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AppNotification - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - url (str): callback URL. [optional] # noqa: E501 - api_key (str): apiKey sent into every callback request, using the X-API-KEY header. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AppNotification from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AppNotification - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - url (str): callback URL. [optional] # noqa: E501 - api_key (str): apiKey sent into every callback request, using the X-API-KEY header. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AppNotification from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "url": obj.get("url"), + "apiKey": obj.get("apiKey") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.url: str = None - self.api_key: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/app_properties.py b/symphony/bdk/gen/pod_model/app_properties.py deleted file mode 100644 index 1eace3b8..00000000 --- a/symphony/bdk/gen/pod_model/app_properties.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.app_property import AppProperty -globals()['AppProperty'] = AppProperty - -class AppProperties(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([AppProperty],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """AppProperties - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([AppProperty]): Application configuration properties that are shared with the extension application, client side. Do not store sensitive information here. Since SBE 20.14.. # noqa: E501 - - Keyword Args: - value ([AppProperty]): Application configuration properties that are shared with the extension application, client side. Do not store sensitive information here. Since SBE 20.14.. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[AppProperty] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """AppProperties - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([AppProperty]): Application configuration properties that are shared with the extension application, client side. Do not store sensitive information here. Since SBE 20.14.. # noqa: E501 - - Keyword Args: - value ([AppProperty]): Application configuration properties that are shared with the extension application, client side. Do not store sensitive information here. Since SBE 20.14.. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/app_property.py b/symphony/bdk/gen/pod_model/app_property.py index 79ef68c8..a8c0dbd0 100644 --- a/symphony/bdk/gen/pod_model/app_property.py +++ b/symphony/bdk/gen/pod_model/app_property.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AppProperty(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'key': (str, none_type), # noqa: E501 - 'value': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class AppProperty(BaseModel): + """ + Application configuration property that is shared with the extension application, client side. Do not store sensitive information here. + """ # noqa: E501 + key: Optional[StrictStr] = Field(default=None, description="Name of an application configuration property. It cannot be null or empty and its length is limited to 1024 characters. Keys are unique.") + value: Optional[StrictStr] = Field(default=None, description="Value of an application configuration property. It cannot be null and its length is limited to 4096 characters. It can be empty.") + __properties: ClassVar[List[str]] = ["key", "value"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'key': 'key', # noqa: E501 - 'value': 'value', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AppProperty - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - key (str): Name of an application configuration property. It cannot be null or empty and its length is limited to 1024 characters. Keys are unique.. [optional] # noqa: E501 - value (str): Value of an application configuration property. It cannot be null and its length is limited to 4096 characters. It can be empty.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AppProperty from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AppProperty - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - key (str): Name of an application configuration property. It cannot be null or empty and its length is limited to 1024 characters. Keys are unique.. [optional] # noqa: E501 - value (str): Value of an application configuration property. It cannot be null and its length is limited to 4096 characters. It can be empty.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AppProperty from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.key: str = None - self.value: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/application_detail.py b/symphony/bdk/gen/pod_model/application_detail.py index c9d0dc88..689bfab2 100644 --- a/symphony/bdk/gen/pod_model/application_detail.py +++ b/symphony/bdk/gen/pod_model/application_detail.py @@ -1,305 +1,124 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.app_authentication_keys import AppAuthenticationKeys from symphony.bdk.gen.pod_model.app_notification import AppNotification -from symphony.bdk.gen.pod_model.app_properties import AppProperties +from symphony.bdk.gen.pod_model.app_property import AppProperty from symphony.bdk.gen.pod_model.application_info import ApplicationInfo -globals()['AppAuthenticationKeys'] = AppAuthenticationKeys -globals()['AppNotification'] = AppNotification -globals()['AppProperties'] = AppProperties -globals()['ApplicationInfo'] = ApplicationInfo - -class ApplicationDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ApplicationDetail(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'application_info': (ApplicationInfo, none_type), # noqa: E501 - 'icon_url': (str, none_type), # noqa: E501 - 'description': (str, none_type), # noqa: E501 - 'allow_origins': (str, none_type), # noqa: E501 - 'permissions': ([str], none_type), # noqa: E501 - 'cert': (str, none_type), # noqa: E501 - 'authentication_keys': (AppAuthenticationKeys, none_type), # noqa: E501 - 'notification': (AppNotification, none_type), # noqa: E501 - 'properties': (AppProperties, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'application_info': 'applicationInfo', # noqa: E501 - 'icon_url': 'iconUrl', # noqa: E501 - 'description': 'description', # noqa: E501 - 'allow_origins': 'allowOrigins', # noqa: E501 - 'permissions': 'permissions', # noqa: E501 - 'cert': 'cert', # noqa: E501 - 'authentication_keys': 'authenticationKeys', # noqa: E501 - 'notification': 'notification', # noqa: E501 - 'properties': 'properties', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + Detailed record of application. + """ # noqa: E501 + application_info: Optional[ApplicationInfo] = Field(default=None, alias="applicationInfo") + icon_url: Optional[StrictStr] = Field(default=None, description="Url to a icon to use for app. Must start with \"https://\".", alias="iconUrl") + description: Optional[StrictStr] = Field(default=None, description="Description of the application.") + allow_origins: Optional[StrictStr] = Field(default=None, description="The permitted domains to send or receive a request from. The field is for the purpose of CORS which set the app specific \"ALLOW-ORIGIN-DOMAINS\" header in HTTP. ", alias="allowOrigins") + permissions: Optional[List[Annotated[str, Field(min_length=1, strict=True, max_length=64)]]] = Field(default=None, description="List of application permissions provisioned for the application. In addition to the known ones, custom permissions are accepted. A custom permission should only contain upper case alphanumeric characters and underscore. It should not be empty or only contain spaces and its length is limited to 64 characters. Known permissions: - SEND_MESSAGES - GET_USER_CONNECTIONS - REQUEST_USER_CONNECTIONS - SET_PRESENCE - GET_PRESENCE - GET_BASIC_USER_INFO - GET_EXTENDED_USER_INFO - GET_BASIC_CONTACT_INFO - GET_EXTENDED_CONTACT_INFO - ACT_AS_USER - MANAGE_SIGNALS - MANAGE_USER_FOLLOWING - TRUST_APP ") + cert: Optional[StrictStr] = Field(default=None, description="The app public certificate in pem format.") + authentication_keys: Optional[AppAuthenticationKeys] = Field(default=None, alias="authenticationKeys") + notification: Optional[AppNotification] = None + properties: Optional[List[AppProperty]] = Field(default=None, description="Application configuration properties that are shared with the extension application, client side. Do not store sensitive information here. Since SBE 20.14.") + __properties: ClassVar[List[str]] = ["applicationInfo", "iconUrl", "description", "allowOrigins", "permissions", "cert", "authenticationKeys", "notification", "properties"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ApplicationDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - application_info (ApplicationInfo): [optional] # noqa: E501 - icon_url (str): Url to a icon to use for app. Must start with \"https://\".. [optional] # noqa: E501 - description (str): Description of the application.. [optional] # noqa: E501 - allow_origins (str): The permitted domains to send or receive a request from. The field is for the purpose of CORS which set the app specific \"ALLOW-ORIGIN-DOMAINS\" header in HTTP. . [optional] # noqa: E501 - permissions ([str]): List of application permissions provisioned for the application. In addition to the known ones, custom permissions are accepted. A custom permission should only contain upper case alphanumeric characters and underscore. It should not be empty or only contain spaces and its length is limited to 64 characters. Known permissions: - SEND_MESSAGES - GET_USER_CONNECTIONS - REQUEST_USER_CONNECTIONS - SET_PRESENCE - GET_PRESENCE - GET_BASIC_USER_INFO - GET_EXTENDED_USER_INFO - GET_BASIC_CONTACT_INFO - GET_EXTENDED_CONTACT_INFO - ACT_AS_USER - MANAGE_SIGNALS - MANAGE_USER_FOLLOWING - TRUST_APP . [optional] # noqa: E501 - cert (str): The app public certificate in pem format.. [optional] # noqa: E501 - authentication_keys (AppAuthenticationKeys): [optional] # noqa: E501 - notification (AppNotification): [optional] # noqa: E501 - properties (AppProperties): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApplicationDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ApplicationDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - application_info (ApplicationInfo): [optional] # noqa: E501 - icon_url (str): Url to a icon to use for app. Must start with \"https://\".. [optional] # noqa: E501 - description (str): Description of the application.. [optional] # noqa: E501 - allow_origins (str): The permitted domains to send or receive a request from. The field is for the purpose of CORS which set the app specific \"ALLOW-ORIGIN-DOMAINS\" header in HTTP. . [optional] # noqa: E501 - permissions ([str]): List of application permissions provisioned for the application. In addition to the known ones, custom permissions are accepted. A custom permission should only contain upper case alphanumeric characters and underscore. It should not be empty or only contain spaces and its length is limited to 64 characters. Known permissions: - SEND_MESSAGES - GET_USER_CONNECTIONS - REQUEST_USER_CONNECTIONS - SET_PRESENCE - GET_PRESENCE - GET_BASIC_USER_INFO - GET_EXTENDED_USER_INFO - GET_BASIC_CONTACT_INFO - GET_EXTENDED_CONTACT_INFO - ACT_AS_USER - MANAGE_SIGNALS - MANAGE_USER_FOLLOWING - TRUST_APP . [optional] # noqa: E501 - cert (str): The app public certificate in pem format.. [optional] # noqa: E501 - authentication_keys (AppAuthenticationKeys): [optional] # noqa: E501 - notification (AppNotification): [optional] # noqa: E501 - properties (AppProperties): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of application_info + if self.application_info: + _dict['applicationInfo'] = self.application_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of authentication_keys + if self.authentication_keys: + _dict['authenticationKeys'] = self.authentication_keys.to_dict() + # override the default output from pydantic by calling `to_dict()` of notification + if self.notification: + _dict['notification'] = self.notification.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in properties (list) + _items = [] + if self.properties: + for _item_properties in self.properties: + if _item_properties: + _items.append(_item_properties.to_dict()) + _dict['properties'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApplicationDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "applicationInfo": ApplicationInfo.from_dict(obj["applicationInfo"]) if obj.get("applicationInfo") is not None else None, + "iconUrl": obj.get("iconUrl"), + "description": obj.get("description"), + "allowOrigins": obj.get("allowOrigins"), + "permissions": obj.get("permissions"), + "cert": obj.get("cert"), + "authenticationKeys": AppAuthenticationKeys.from_dict(obj["authenticationKeys"]) if obj.get("authenticationKeys") is not None else None, + "notification": AppNotification.from_dict(obj["notification"]) if obj.get("notification") is not None else None, + "properties": [AppProperty.from_dict(_item) for _item in obj["properties"]] if obj.get("properties") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.application_info: ApplicationInfo = None - self.icon_url: str = None - self.description: str = None - self.allow_origins: str = None - self.permissions: List[str] = None - self.cert: str = None - self.authentication_keys: AppAuthenticationKeys = None - self.notification: AppNotification = None - self.properties: AppProperties = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/application_info.py b/symphony/bdk/gen/pod_model/application_info.py index 521dba86..aace260e 100644 --- a/symphony/bdk/gen/pod_model/application_info.py +++ b/symphony/bdk/gen/pod_model/application_info.py @@ -1,280 +1,96 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class ApplicationInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class ApplicationInfo(BaseModel): """ + Required information for creating an application. + """ # noqa: E501 + app_id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=256)]] = Field(default=None, description="An unique id for the application.", alias="appId") + name: Optional[StrictStr] = Field(default=None, description="User defined name for the application.") + app_url: Optional[StrictStr] = Field(default=None, description="The url for the app. Must start with \"https://\".", alias="appUrl") + domain: Optional[StrictStr] = Field(default=None, description="Domain for app, that must match app url domain.") + publisher: Optional[StrictStr] = Field(default=None, description="The publisher for this application.") + __properties: ClassVar[List[str]] = ["appId", "name", "appUrl", "domain", "publisher"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - ('app_id',): { - 'max_length': 256, - 'min_length': 1, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApplicationInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'app_id': (str, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'app_url': (str, none_type), # noqa: E501 - 'domain': (str, none_type), # noqa: E501 - 'publisher': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'app_id': 'appId', # noqa: E501 - 'name': 'name', # noqa: E501 - 'app_url': 'appUrl', # noqa: E501 - 'domain': 'domain', # noqa: E501 - 'publisher': 'publisher', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ApplicationInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_id (str): An unique id for the application.. [optional] # noqa: E501 - name (str): User defined name for the application.. [optional] # noqa: E501 - app_url (str): The url for the app. Must start with \"https://\".. [optional] # noqa: E501 - domain (str): Domain for app, that must match app url domain.. [optional] # noqa: E501 - publisher (str): The publisher for this application.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ApplicationInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_id (str): An unique id for the application.. [optional] # noqa: E501 - name (str): User defined name for the application.. [optional] # noqa: E501 - app_url (str): The url for the app. Must start with \"https://\".. [optional] # noqa: E501 - domain (str): Domain for app, that must match app url domain.. [optional] # noqa: E501 - publisher (str): The publisher for this application.. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApplicationInfo from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "appId": obj.get("appId"), + "name": obj.get("name"), + "appUrl": obj.get("appUrl"), + "domain": obj.get("domain"), + "publisher": obj.get("publisher") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.app_id: str = None - self.name: str = None - self.app_url: str = None - self.domain: str = None - self.publisher: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/assignee_candidate.py b/symphony/bdk/gen/pod_model/assignee_candidate.py index 3015f315..4ac3dca7 100644 --- a/symphony/bdk/gen/pod_model/assignee_candidate.py +++ b/symphony/bdk/gen/pod_model/assignee_candidate.py @@ -1,289 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.string_list import StringList -globals()['StringList'] = StringList - -class AssigneeCandidate(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_id': (int, none_type), # noqa: E501 - 'username': (str, none_type), # noqa: E501 - 'first_name': (str, none_type), # noqa: E501 - 'surname': (str, none_type), # noqa: E501 - 'email_address': (str, none_type), # noqa: E501 - 'can_be_assigned': (bool, none_type), # noqa: E501 - 'roles': (StringList, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user_id': 'userId', # noqa: E501 - 'username': 'username', # noqa: E501 - 'first_name': 'firstName', # noqa: E501 - 'surname': 'surname', # noqa: E501 - 'email_address': 'emailAddress', # noqa: E501 - 'can_be_assigned': 'canBeAssigned', # noqa: E501 - 'roles': 'roles', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class AssigneeCandidate(BaseModel): + """ + Assignee Candidate + """ # noqa: E501 + user_id: Optional[StrictInt] = Field(default=None, alias="userId") + username: Optional[StrictStr] = None + first_name: Optional[StrictStr] = Field(default=None, alias="firstName") + surname: Optional[StrictStr] = None + email_address: Optional[StrictStr] = Field(default=None, alias="emailAddress") + can_be_assigned: Optional[StrictBool] = Field(default=None, alias="canBeAssigned") + roles: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["userId", "username", "firstName", "surname", "emailAddress", "canBeAssigned", "roles"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AssigneeCandidate - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssigneeCandidate from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): [optional] # noqa: E501 - username (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - surname (str): [optional] # noqa: E501 - email_address (str): [optional] # noqa: E501 - can_be_assigned (bool): [optional] # noqa: E501 - roles (StringList): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AssigneeCandidate - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): [optional] # noqa: E501 - username (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - surname (str): [optional] # noqa: E501 - email_address (str): [optional] # noqa: E501 - can_be_assigned (bool): [optional] # noqa: E501 - roles (StringList): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssigneeCandidate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "userId": obj.get("userId"), + "username": obj.get("username"), + "firstName": obj.get("firstName"), + "surname": obj.get("surname"), + "emailAddress": obj.get("emailAddress"), + "canBeAssigned": obj.get("canBeAssigned"), + "roles": obj.get("roles") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_id: int = None - self.username: str = None - self.first_name: str = None - self.surname: str = None - self.email_address: str = None - self.can_be_assigned: bool = None - self.roles: StringList = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/assignee_candidates.py b/symphony/bdk/gen/pod_model/assignee_candidates.py index cdafcaf2..b0830ce5 100644 --- a/symphony/bdk/gen/pod_model/assignee_candidates.py +++ b/symphony/bdk/gen/pod_model/assignee_candidates.py @@ -1,266 +1,101 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.assignee_candidate import AssigneeCandidate from symphony.bdk.gen.pod_model.pagination import Pagination -globals()['AssigneeCandidate'] = AssigneeCandidate -globals()['Pagination'] = Pagination +from typing import Optional, Set +from typing_extensions import Self -class AssigneeCandidates(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class AssigneeCandidates(BaseModel): """ + List of assignee candidate + """ # noqa: E501 + users: Optional[List[AssigneeCandidate]] = None + pagination: Optional[Pagination] = None + __properties: ClassVar[List[str]] = ["users", "pagination"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'users': ([AssigneeCandidate], none_type), # noqa: E501 - 'pagination': (Pagination, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'users': 'users', # noqa: E501 - 'pagination': 'pagination', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AssigneeCandidates - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - users ([AssigneeCandidate]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AssigneeCandidates from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AssigneeCandidates - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - users ([AssigneeCandidate]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in users (list) + _items = [] + if self.users: + for _item_users in self.users: + if _item_users: + _items.append(_item_users.to_dict()) + _dict['users'] = _items + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AssigneeCandidates from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "users": [AssigneeCandidate.from_dict(_item) for _item in obj["users"]] if obj.get("users") is not None else None, + "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.users: List[AssigneeCandidate] = None - self.pagination: Pagination = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/attachment_preview.py b/symphony/bdk/gen/pod_model/attachment_preview.py index 22fdbb6a..e8668f8b 100644 --- a/symphony/bdk/gen/pod_model/attachment_preview.py +++ b/symphony/bdk/gen/pod_model/attachment_preview.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AttachmentPreview(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'file_id': (str, none_type), # noqa: E501 - 'width': (int, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class AttachmentPreview(BaseModel): + """ + Preview file for image attachments + """ # noqa: E501 + file_id: Optional[StrictStr] = Field(default=None, description="The preview file ID", alias="fileId") + width: Optional[StrictInt] = Field(default=None, description="The preview image width") + __properties: ClassVar[List[str]] = ["fileId", "width"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'file_id': 'fileId', # noqa: E501 - 'width': 'width', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AttachmentPreview - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - file_id (str): The preview file ID. [optional] # noqa: E501 - width (int): The preview image width. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AttachmentPreview from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AttachmentPreview - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - file_id (str): The preview file ID. [optional] # noqa: E501 - width (int): The preview image width. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AttachmentPreview from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "fileId": obj.get("fileId"), + "width": obj.get("width") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.file_id: str = None - self.width: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/avatar.py b/symphony/bdk/gen/pod_model/avatar.py index f413b00e..2ccb72f9 100644 --- a/symphony/bdk/gen/pod_model/avatar.py +++ b/symphony/bdk/gen/pod_model/avatar.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Avatar(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'size': (str, none_type), # noqa: E501 - 'url': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Avatar(BaseModel): + """ + Avatar + """ # noqa: E501 + size: Optional[StrictStr] = Field(default=None, description="The Avatar Size") + url: Optional[StrictStr] = Field(default=None, description="Url of the image") + __properties: ClassVar[List[str]] = ["size", "url"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'size': 'size', # noqa: E501 - 'url': 'url', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Avatar - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - size (str): The Avatar Size. [optional] # noqa: E501 - url (str): Url of the image. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Avatar from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Avatar - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - size (str): The Avatar Size. [optional] # noqa: E501 - url (str): Url of the image. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Avatar from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "size": obj.get("size"), + "url": obj.get("url") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.size: str = None - self.url: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/avatar_list.py b/symphony/bdk/gen/pod_model/avatar_list.py deleted file mode 100644 index 621a7fdc..00000000 --- a/symphony/bdk/gen/pod_model/avatar_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.avatar import Avatar -globals()['Avatar'] = Avatar - -class AvatarList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([Avatar],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """AvatarList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Avatar]): # noqa: E501 - - Keyword Args: - value ([Avatar]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[Avatar] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """AvatarList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Avatar]): # noqa: E501 - - Keyword Args: - value ([Avatar]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/avatar_update.py b/symphony/bdk/gen/pod_model/avatar_update.py index a6a8f76a..9a63f4db 100644 --- a/symphony/bdk/gen/pod_model/avatar_update.py +++ b/symphony/bdk/gen/pod_model/avatar_update.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class AvatarUpdate(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'image': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class AvatarUpdate(BaseModel): + """ + AvatarUpdate + """ # noqa: E501 + image: Optional[StrictStr] = Field(default=None, description="Base64 encoded image. Original image must be less than 2MB.") + __properties: ClassVar[List[str]] = ["image"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'image': 'image', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """AvatarUpdate - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - image (str): Base64 encoded image. Original image must be less than 2MB.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AvatarUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """AvatarUpdate - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - image (str): Base64 encoded image. Original image must be less than 2MB.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AvatarUpdate from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "image": obj.get("image") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.image: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/bulk_action_result.py b/symphony/bdk/gen/pod_model/bulk_action_result.py index c64894e5..a7d249d3 100644 --- a/symphony/bdk/gen/pod_model/bulk_action_result.py +++ b/symphony/bdk/gen/pod_model/bulk_action_result.py @@ -1,265 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class BulkActionResult(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class BulkActionResult(BaseModel): """ + The results of list based bulk action. The list contains the result messages in the same order as submitted. The message will be an empty string if the action was successful for item in that index. + """ # noqa: E501 + overall_result: Optional[StrictStr] = Field(default=None, alias="overallResult") + results: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["overallResult", "results"] + + @field_validator('overall_result') + def overall_result_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SUCCESS', 'FAIL']): + raise ValueError("must be one of enum values ('SUCCESS', 'FAIL')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('overall_result',): { - 'SUCCESS': "SUCCESS", - 'FAIL': "FAIL", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BulkActionResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'overall_result': (str, none_type), # noqa: E501 - 'results': ([str], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'overall_result': 'overallResult', # noqa: E501 - 'results': 'results', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """BulkActionResult - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - overall_result (str): [optional] # noqa: E501 - results ([str]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """BulkActionResult - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - overall_result (str): [optional] # noqa: E501 - results ([str]): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BulkActionResult from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "overallResult": obj.get("overallResult"), + "results": obj.get("results") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.overall_result: str = None - self.results: List[str] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/cert_info.py b/symphony/bdk/gen/pod_model/cert_info.py deleted file mode 100644 index 98529f37..00000000 --- a/symphony/bdk/gen/pod_model/cert_info.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.cert_info_item import CertInfoItem -globals()['CertInfoItem'] = CertInfoItem - -class CertInfo(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([CertInfoItem],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """CertInfo - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([CertInfoItem]): # noqa: E501 - - Keyword Args: - value ([CertInfoItem]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[CertInfoItem] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """CertInfo - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([CertInfoItem]): # noqa: E501 - - Keyword Args: - value ([CertInfoItem]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/cert_info_item.py b/symphony/bdk/gen/pod_model/cert_info_item.py index c3cedc7b..bbba50cb 100644 --- a/symphony/bdk/gen/pod_model/cert_info_item.py +++ b/symphony/bdk/gen/pod_model/cert_info_item.py @@ -1,264 +1,97 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.name_value_pair import NameValuePair -globals()['NameValuePair'] = NameValuePair +from typing import Optional, Set +from typing_extensions import Self -class CertInfoItem(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class CertInfoItem(BaseModel): """ + CertInfoItem + """ # noqa: E501 + name: Optional[StrictStr] = None + attributes: Optional[List[NameValuePair]] = None + __properties: ClassVar[List[str]] = ["name", "attributes"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str, none_type), # noqa: E501 - 'attributes': ([NameValuePair], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'name': 'name', # noqa: E501 - 'attributes': 'attributes', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """CertInfoItem - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): [optional] # noqa: E501 - attributes ([NameValuePair]): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CertInfoItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """CertInfoItem - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): [optional] # noqa: E501 - attributes ([NameValuePair]): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in attributes (list) + _items = [] + if self.attributes: + for _item_attributes in self.attributes: + if _item_attributes: + _items.append(_item_attributes.to_dict()) + _dict['attributes'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CertInfoItem from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "attributes": [NameValuePair.from_dict(_item) for _item in obj["attributes"]] if obj.get("attributes") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.attributes: List[NameValuePair] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/company_cert.py b/symphony/bdk/gen/pod_model/company_cert.py index ae32ab49..62f241a2 100644 --- a/symphony/bdk/gen/pod_model/company_cert.py +++ b/symphony/bdk/gen/pod_model/company_cert.py @@ -1,264 +1,93 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.company_cert_attributes import CompanyCertAttributes -globals()['CompanyCertAttributes'] = CompanyCertAttributes +from typing import Optional, Set +from typing_extensions import Self -class CompanyCert(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class CompanyCert(BaseModel): """ + CompanyCert + """ # noqa: E501 + pem: Optional[StrictStr] = Field(default=None, description="An X509 certificate in PEM format") + attributes: Optional[CompanyCertAttributes] = None + __properties: ClassVar[List[str]] = ["pem", "attributes"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'pem': (str, none_type), # noqa: E501 - 'attributes': (CompanyCertAttributes, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'pem': 'pem', # noqa: E501 - 'attributes': 'attributes', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """CompanyCert - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pem (str): An X509 certificate in PEM format. [optional] # noqa: E501 - attributes (CompanyCertAttributes): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyCert from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """CompanyCert - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pem (str): An X509 certificate in PEM format. [optional] # noqa: E501 - attributes (CompanyCertAttributes): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyCert from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "pem": obj.get("pem"), + "attributes": CompanyCertAttributes.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.pem: str = None - self.attributes: CompanyCertAttributes = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/company_cert_attributes.py b/symphony/bdk/gen/pod_model/company_cert_attributes.py index f9653379..7e3cc9f7 100644 --- a/symphony/bdk/gen/pod_model/company_cert_attributes.py +++ b/symphony/bdk/gen/pod_model/company_cert_attributes.py @@ -1,271 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.company_cert_status import CompanyCertStatus from symphony.bdk.gen.pod_model.company_cert_type import CompanyCertType -globals()['CompanyCertStatus'] = CompanyCertStatus -globals()['CompanyCertType'] = CompanyCertType +from typing import Optional, Set +from typing_extensions import Self -class CompanyCertAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class CompanyCertAttributes(BaseModel): """ + CompanyCertAttributes + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Friendly name assigned by administrator") + type: Optional[CompanyCertType] = None + status: Optional[CompanyCertStatus] = None + __properties: ClassVar[List[str]] = ["name", "type", "status"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str, none_type), # noqa: E501 - 'type': (CompanyCertType, none_type), # noqa: E501 - 'status': (CompanyCertStatus, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'name': 'name', # noqa: E501 - 'type': 'type', # noqa: E501 - 'status': 'status', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """CompanyCertAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Friendly name assigned by administrator. [optional] # noqa: E501 - type (CompanyCertType): [optional] # noqa: E501 - status (CompanyCertStatus): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyCertAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """CompanyCertAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Friendly name assigned by administrator. [optional] # noqa: E501 - type (CompanyCertType): [optional] # noqa: E501 - status (CompanyCertStatus): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of type + if self.type: + _dict['type'] = self.type.to_dict() + # override the default output from pydantic by calling `to_dict()` of status + if self.status: + _dict['status'] = self.status.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyCertAttributes from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "type": CompanyCertType.from_dict(obj["type"]) if obj.get("type") is not None else None, + "status": CompanyCertStatus.from_dict(obj["status"]) if obj.get("status") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.type: CompanyCertType = None - self.status: CompanyCertStatus = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/company_cert_detail.py b/symphony/bdk/gen/pod_model/company_cert_detail.py index 8b4e1ccd..edd53680 100644 --- a/symphony/bdk/gen/pod_model/company_cert_detail.py +++ b/symphony/bdk/gen/pod_model/company_cert_detail.py @@ -1,273 +1,107 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.pod_model.cert_info import CertInfo +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from symphony.bdk.gen.pod_model.cert_info_item import CertInfoItem from symphony.bdk.gen.pod_model.company_cert_attributes import CompanyCertAttributes from symphony.bdk.gen.pod_model.company_cert_info import CompanyCertInfo -globals()['CertInfo'] = CertInfo -globals()['CompanyCertAttributes'] = CompanyCertAttributes -globals()['CompanyCertInfo'] = CompanyCertInfo +from typing import Optional, Set +from typing_extensions import Self -class CompanyCertDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class CompanyCertDetail(BaseModel): """ + CompanyCertDetail + """ # noqa: E501 + company_cert_attributes: Optional[CompanyCertAttributes] = Field(default=None, alias="companyCertAttributes") + company_cert_info: Optional[CompanyCertInfo] = Field(default=None, alias="companyCertInfo") + cert_info: Optional[List[CertInfoItem]] = Field(default=None, alias="certInfo") + __properties: ClassVar[List[str]] = ["companyCertAttributes", "companyCertInfo", "certInfo"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'company_cert_attributes': (CompanyCertAttributes, none_type), # noqa: E501 - 'company_cert_info': (CompanyCertInfo, none_type), # noqa: E501 - 'cert_info': (CertInfo, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'company_cert_attributes': 'companyCertAttributes', # noqa: E501 - 'company_cert_info': 'companyCertInfo', # noqa: E501 - 'cert_info': 'certInfo', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """CompanyCertDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - company_cert_attributes (CompanyCertAttributes): [optional] # noqa: E501 - company_cert_info (CompanyCertInfo): [optional] # noqa: E501 - cert_info (CertInfo): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyCertDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """CompanyCertDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - company_cert_attributes (CompanyCertAttributes): [optional] # noqa: E501 - company_cert_info (CompanyCertInfo): [optional] # noqa: E501 - cert_info (CertInfo): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of company_cert_attributes + if self.company_cert_attributes: + _dict['companyCertAttributes'] = self.company_cert_attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of company_cert_info + if self.company_cert_info: + _dict['companyCertInfo'] = self.company_cert_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in cert_info (list) + _items = [] + if self.cert_info: + for _item_cert_info in self.cert_info: + if _item_cert_info: + _items.append(_item_cert_info.to_dict()) + _dict['certInfo'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyCertDetail from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "companyCertAttributes": CompanyCertAttributes.from_dict(obj["companyCertAttributes"]) if obj.get("companyCertAttributes") is not None else None, + "companyCertInfo": CompanyCertInfo.from_dict(obj["companyCertInfo"]) if obj.get("companyCertInfo") is not None else None, + "certInfo": [CertInfoItem.from_dict(_item) for _item in obj["certInfo"]] if obj.get("certInfo") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.company_cert_attributes: CompanyCertAttributes = None - self.company_cert_info: CompanyCertInfo = None - self.cert_info: CertInfo = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/company_cert_info.py b/symphony/bdk/gen/pod_model/company_cert_info.py index 975328cc..34e25ead 100644 --- a/symphony/bdk/gen/pod_model/company_cert_info.py +++ b/symphony/bdk/gen/pod_model/company_cert_info.py @@ -1,286 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class CompanyCertInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'finger_print': (str, none_type), # noqa: E501 - 'issuer_finger_print': (str, none_type), # noqa: E501 - 'last_seen': (int, none_type), # noqa: E501 - 'updated_at': (int, none_type), # noqa: E501 - 'updated_by': (int, none_type), # noqa: E501 - 'common_name': (str, none_type), # noqa: E501 - 'expiry_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'finger_print': 'fingerPrint', # noqa: E501 - 'issuer_finger_print': 'issuerFingerPrint', # noqa: E501 - 'last_seen': 'lastSeen', # noqa: E501 - 'updated_at': 'updatedAt', # noqa: E501 - 'updated_by': 'updatedBy', # noqa: E501 - 'common_name': 'commonName', # noqa: E501 - 'expiry_date': 'expiryDate', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class CompanyCertInfo(BaseModel): + """ + CompanyCertInfo + """ # noqa: E501 + finger_print: Optional[StrictStr] = Field(default=None, description="Unique identifier", alias="fingerPrint") + issuer_finger_print: Optional[StrictStr] = Field(default=None, description="Unique identifier of issuer cert if known", alias="issuerFingerPrint") + last_seen: Optional[StrictInt] = Field(default=None, description="Date when we last saw this certificate presented", alias="lastSeen") + updated_at: Optional[StrictInt] = Field(default=None, description="Date when this cert was last updated by administrator", alias="updatedAt") + updated_by: Optional[StrictInt] = Field(default=None, description="User ID of administrator who last updated this cert", alias="updatedBy") + common_name: Optional[StrictStr] = Field(default=None, description="The Symphony account name which this certificate authenticates", alias="commonName") + expiry_date: Optional[StrictInt] = Field(default=None, description="Expiry date of this cert", alias="expiryDate") + __properties: ClassVar[List[str]] = ["fingerPrint", "issuerFingerPrint", "lastSeen", "updatedAt", "updatedBy", "commonName", "expiryDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """CompanyCertInfo - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyCertInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - finger_print (str): Unique identifier. [optional] # noqa: E501 - issuer_finger_print (str): Unique identifier of issuer cert if known. [optional] # noqa: E501 - last_seen (int): Date when we last saw this certificate presented. [optional] # noqa: E501 - updated_at (int): Date when this cert was last updated by administrator. [optional] # noqa: E501 - updated_by (int): User ID of administrator who last updated this cert. [optional] # noqa: E501 - common_name (str): The Symphony account name which this certificate authenticates. [optional] # noqa: E501 - expiry_date (int): Expiry date of this cert. [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """CompanyCertInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - finger_print (str): Unique identifier. [optional] # noqa: E501 - issuer_finger_print (str): Unique identifier of issuer cert if known. [optional] # noqa: E501 - last_seen (int): Date when we last saw this certificate presented. [optional] # noqa: E501 - updated_at (int): Date when this cert was last updated by administrator. [optional] # noqa: E501 - updated_by (int): User ID of administrator who last updated this cert. [optional] # noqa: E501 - common_name (str): The Symphony account name which this certificate authenticates. [optional] # noqa: E501 - expiry_date (int): Expiry date of this cert. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyCertInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "fingerPrint": obj.get("fingerPrint"), + "issuerFingerPrint": obj.get("issuerFingerPrint"), + "lastSeen": obj.get("lastSeen"), + "updatedAt": obj.get("updatedAt"), + "updatedBy": obj.get("updatedBy"), + "commonName": obj.get("commonName"), + "expiryDate": obj.get("expiryDate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.finger_print: str = None - self.issuer_finger_print: str = None - self.last_seen: int = None - self.updated_at: int = None - self.updated_by: int = None - self.common_name: str = None - self.expiry_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/company_cert_info_list.py b/symphony/bdk/gen/pod_model/company_cert_info_list.py deleted file mode 100644 index f2ada80b..00000000 --- a/symphony/bdk/gen/pod_model/company_cert_info_list.py +++ /dev/null @@ -1,278 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class CompanyCertInfoList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """CompanyCertInfoList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}]): # noqa: E501 - - Keyword Args: - value ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[{str: (bool, date, datetime, dict, float, int, list, str, none_type)}] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """CompanyCertInfoList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}]): # noqa: E501 - - Keyword Args: - value ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/company_cert_info_list_inner.py b/symphony/bdk/gen/pod_model/company_cert_info_list_inner.py new file mode 100644 index 00000000..b1de02a0 --- /dev/null +++ b/symphony/bdk/gen/pod_model/company_cert_info_list_inner.py @@ -0,0 +1,97 @@ +# coding: utf-8 + +""" + Pod API + + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. + + The version of the OpenAPI document: 20.17.1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from symphony.bdk.gen.pod_model.company_cert_attributes import CompanyCertAttributes +from symphony.bdk.gen.pod_model.company_cert_info import CompanyCertInfo +from typing import Optional, Set +from typing_extensions import Self + +class CompanyCertInfoListInner(BaseModel): + """ + CompanyCertInfoListInner + """ # noqa: E501 + company_cert_attributes: Optional[CompanyCertAttributes] = Field(default=None, alias="companyCertAttributes") + company_cert_info: Optional[CompanyCertInfo] = Field(default=None, alias="companyCertInfo") + __properties: ClassVar[List[str]] = ["companyCertAttributes", "companyCertInfo"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyCertInfoListInner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of company_cert_attributes + if self.company_cert_attributes: + _dict['companyCertAttributes'] = self.company_cert_attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of company_cert_info + if self.company_cert_info: + _dict['companyCertInfo'] = self.company_cert_info.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyCertInfoListInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "companyCertAttributes": CompanyCertAttributes.from_dict(obj["companyCertAttributes"]) if obj.get("companyCertAttributes") is not None else None, + "companyCertInfo": CompanyCertInfo.from_dict(obj["companyCertInfo"]) if obj.get("companyCertInfo") is not None else None + }) + return _obj + + diff --git a/symphony/bdk/gen/pod_model/company_cert_status.py b/symphony/bdk/gen/pod_model/company_cert_status.py index 75604220..8e95243b 100644 --- a/symphony/bdk/gen/pod_model/company_cert_status.py +++ b/symphony/bdk/gen/pod_model/company_cert_status.py @@ -1,262 +1,97 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class CompanyCertStatus(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('type',): { - 'TRUSTED': "TRUSTED", - 'KNOWN': "KNOWN", - 'REVOKED': "REVOKED", - 'DISABLED': "DISABLED", - }, - } - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - _nullable = False +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +class CompanyCertStatus(BaseModel): + """ + CompanyCertStatus + """ # noqa: E501 + type: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type"] - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str, none_type), # noqa: E501 - } + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - @cached_property - def discriminator(): - return None + if value not in set(['TRUSTED', 'KNOWN', 'REVOKED', 'DISABLED']): + raise ValueError("must be one of enum values ('TRUSTED', 'KNOWN', 'REVOKED', 'DISABLED')") + return value + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'type': 'type', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """CompanyCertStatus - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyCertStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """CompanyCertStatus - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyCertStatus from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/company_cert_type.py b/symphony/bdk/gen/pod_model/company_cert_type.py index 49385dd3..9d08e156 100644 --- a/symphony/bdk/gen/pod_model/company_cert_type.py +++ b/symphony/bdk/gen/pod_model/company_cert_type.py @@ -1,262 +1,97 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class CompanyCertType(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('type',): { - 'USERSIGNING': "USERSIGNING", - 'USER': "USER", - 'OPERATIONSSIGNING': "OPERATIONSSIGNING", - 'OPERATIONSUSER': "OPERATIONSUSER", - }, - } - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - _nullable = False +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +class CompanyCertType(BaseModel): + """ + CompanyCertType + """ # noqa: E501 + type: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type"] - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str, none_type), # noqa: E501 - } + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - @cached_property - def discriminator(): - return None + if value not in set(['USERSIGNING', 'USER', 'OPERATIONSSIGNING', 'OPERATIONSUSER']): + raise ValueError("must be one of enum values ('USERSIGNING', 'USER', 'OPERATIONSSIGNING', 'OPERATIONSUSER')") + return value + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'type': 'type', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """CompanyCertType - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CompanyCertType from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """CompanyCertType - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CompanyCertType from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/company_cert_type_list.py b/symphony/bdk/gen/pod_model/company_cert_type_list.py deleted file mode 100644 index f169c28e..00000000 --- a/symphony/bdk/gen/pod_model/company_cert_type_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.company_cert_type import CompanyCertType -globals()['CompanyCertType'] = CompanyCertType - -class CompanyCertTypeList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([CompanyCertType],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """CompanyCertTypeList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([CompanyCertType]): # noqa: E501 - - Keyword Args: - value ([CompanyCertType]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[CompanyCertType] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """CompanyCertTypeList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([CompanyCertType]): # noqa: E501 - - Keyword Args: - value ([CompanyCertType]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/conversation_specific_stream_attributes.py b/symphony/bdk/gen/pod_model/conversation_specific_stream_attributes.py index e9e5e3c2..1f3c2f9b 100644 --- a/symphony/bdk/gen/pod_model/conversation_specific_stream_attributes.py +++ b/symphony/bdk/gen/pod_model/conversation_specific_stream_attributes.py @@ -1,259 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.user_id_list import UserIdList -globals()['UserIdList'] = UserIdList - -class ConversationSpecificStreamAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'members': (UserIdList, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class ConversationSpecificStreamAttributes(BaseModel): + """ + ConversationSpecificStreamAttributes + """ # noqa: E501 + members: Optional[List[StrictInt]] = None + __properties: ClassVar[List[str]] = ["members"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'members': 'members', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ConversationSpecificStreamAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - members (UserIdList): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConversationSpecificStreamAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ConversationSpecificStreamAttributes - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - members (UserIdList): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConversationSpecificStreamAttributes from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "members": obj.get("members") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.members: UserIdList = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/delegate_action.py b/symphony/bdk/gen/pod_model/delegate_action.py index 8326160c..91789718 100644 --- a/symphony/bdk/gen/pod_model/delegate_action.py +++ b/symphony/bdk/gen/pod_model/delegate_action.py @@ -1,265 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class DelegateAction(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class DelegateAction(BaseModel): """ + DelegateAction + """ # noqa: E501 + user_id: Optional[StrictInt] = Field(default=None, alias="userId") + action: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["userId", "action"] + + @field_validator('action') + def action_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ADD', 'REMOVE']): + raise ValueError("must be one of enum values ('ADD', 'REMOVE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('action',): { - 'ADD': "ADD", - 'REMOVE': "REMOVE", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DelegateAction from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'user_id': (int, none_type), # noqa: E501 - 'action': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'user_id': 'userId', # noqa: E501 - 'action': 'action', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """DelegateAction - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): [optional] # noqa: E501 - action (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """DelegateAction - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): [optional] # noqa: E501 - action (str): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DelegateAction from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "userId": obj.get("userId"), + "action": obj.get("action") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_id: int = None - self.action: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/disclaimer.py b/symphony/bdk/gen/pod_model/disclaimer.py index 7eae83e8..8c14b1b7 100644 --- a/symphony/bdk/gen/pod_model/disclaimer.py +++ b/symphony/bdk/gen/pod_model/disclaimer.py @@ -1,300 +1,113 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Disclaimer(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('format',): { - 'TEXT': "TEXT", - 'XML': "XML", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'content': (str, none_type), # noqa: E501 - 'frequency_in_hours': (int, none_type), # noqa: E501 - 'is_default': (bool, none_type), # noqa: E501 - 'is_active': (bool, none_type), # noqa: E501 - 'created_date': (int, none_type), # noqa: E501 - 'modified_date': (int, none_type), # noqa: E501 - 'format': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - 'content': 'content', # noqa: E501 - 'frequency_in_hours': 'frequencyInHours', # noqa: E501 - 'is_default': 'isDefault', # noqa: E501 - 'is_active': 'isActive', # noqa: E501 - 'created_date': 'createdDate', # noqa: E501 - 'modified_date': 'modifiedDate', # noqa: E501 - 'format': 'format', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class Disclaimer(BaseModel): + """ + Disclaimer + """ # noqa: E501 + id: Optional[StrictStr] = None + name: Optional[StrictStr] = None + content: Optional[StrictStr] = None + frequency_in_hours: Optional[StrictInt] = Field(default=None, alias="frequencyInHours") + is_default: Optional[StrictBool] = Field(default=None, alias="isDefault") + is_active: Optional[StrictBool] = Field(default=None, alias="isActive") + created_date: Optional[StrictInt] = Field(default=None, alias="createdDate") + modified_date: Optional[StrictInt] = Field(default=None, alias="modifiedDate") + format: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "name", "content", "frequencyInHours", "isDefault", "isActive", "createdDate", "modifiedDate", "format"] + + @field_validator('format') + def format_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['TEXT', 'XML']): + raise ValueError("must be one of enum values ('TEXT', 'XML')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Disclaimer - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Disclaimer from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - content (str): [optional] # noqa: E501 - frequency_in_hours (int): [optional] # noqa: E501 - is_default (bool): [optional] # noqa: E501 - is_active (bool): [optional] # noqa: E501 - created_date (int): [optional] # noqa: E501 - modified_date (int): [optional] # noqa: E501 - format (str): [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Disclaimer - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - content (str): [optional] # noqa: E501 - frequency_in_hours (int): [optional] # noqa: E501 - is_default (bool): [optional] # noqa: E501 - is_active (bool): [optional] # noqa: E501 - created_date (int): [optional] # noqa: E501 - modified_date (int): [optional] # noqa: E501 - format (str): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Disclaimer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "content": obj.get("content"), + "frequencyInHours": obj.get("frequencyInHours"), + "isDefault": obj.get("isDefault"), + "isActive": obj.get("isActive"), + "createdDate": obj.get("createdDate"), + "modifiedDate": obj.get("modifiedDate"), + "format": obj.get("format") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.name: str = None - self.content: str = None - self.frequency_in_hours: int = None - self.is_default: bool = None - self.is_active: bool = None - self.created_date: int = None - self.modified_date: int = None - self.format: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/disclaimer_list.py b/symphony/bdk/gen/pod_model/disclaimer_list.py deleted file mode 100644 index 3c098eba..00000000 --- a/symphony/bdk/gen/pod_model/disclaimer_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.disclaimer import Disclaimer -globals()['Disclaimer'] = Disclaimer - -class DisclaimerList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([Disclaimer],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """DisclaimerList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Disclaimer]): # noqa: E501 - - Keyword Args: - value ([Disclaimer]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[Disclaimer] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """DisclaimerList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Disclaimer]): # noqa: E501 - - Keyword Args: - value ([Disclaimer]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/download_receipt_count.py b/symphony/bdk/gen/pod_model/download_receipt_count.py index bce54270..7e1f5170 100644 --- a/symphony/bdk/gen/pod_model/download_receipt_count.py +++ b/symphony/bdk/gen/pod_model/download_receipt_count.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class DownloadReceiptCount(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'file_name': (str, none_type), # noqa: E501 - 'timestamp': (int, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class DownloadReceiptCount(BaseModel): + """ + DownloadReceiptCount + """ # noqa: E501 + file_name: Optional[StrictStr] = Field(default=None, alias="fileName") + timestamp: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["fileName", "timestamp"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'file_name': 'fileName', # noqa: E501 - 'timestamp': 'timestamp', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """DownloadReceiptCount - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - file_name (str): [optional] # noqa: E501 - timestamp (int): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DownloadReceiptCount from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """DownloadReceiptCount - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - file_name (str): [optional] # noqa: E501 - timestamp (int): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DownloadReceiptCount from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "fileName": obj.get("fileName"), + "timestamp": obj.get("timestamp") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.file_name: str = None - self.timestamp: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/error.py b/symphony/bdk/gen/pod_model/error.py index 69aaf802..3fa9057c 100644 --- a/symphony/bdk/gen/pod_model/error.py +++ b/symphony/bdk/gen/pod_model/error.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Error(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'code': (int, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Error(BaseModel): + """ + Error + """ # noqa: E501 + code: Optional[StrictInt] = None + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["code", "message"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'code': 'code', # noqa: E501 - 'message': 'message', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Error - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - code (int): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Error from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Error - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - code (int): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Error from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.code: int = None - self.message: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/faceted_match_count.py b/symphony/bdk/gen/pod_model/faceted_match_count.py index e6bc0da1..e7596002 100644 --- a/symphony/bdk/gen/pod_model/faceted_match_count.py +++ b/symphony/bdk/gen/pod_model/faceted_match_count.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class FacetedMatchCount(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'facet': (str, none_type), # noqa: E501 - 'count': (int, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class FacetedMatchCount(BaseModel): + """ + An object respresenting the result count of faceted search. + """ # noqa: E501 + facet: Optional[StrictStr] = Field(default=None, description="The matched query.") + count: Optional[StrictInt] = Field(default=None, description="The result count.") + __properties: ClassVar[List[str]] = ["facet", "count"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'facet': 'facet', # noqa: E501 - 'count': 'count', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """FacetedMatchCount - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - facet (str): The matched query.. [optional] # noqa: E501 - count (int): The result count.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FacetedMatchCount from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """FacetedMatchCount - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - facet (str): The matched query.. [optional] # noqa: E501 - count (int): The result count.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FacetedMatchCount from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "facet": obj.get("facet"), + "count": obj.get("count") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.facet: str = None - self.count: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/feature.py b/symphony/bdk/gen/pod_model/feature.py index fdbcbda6..863b3904 100644 --- a/symphony/bdk/gen/pod_model/feature.py +++ b/symphony/bdk/gen/pod_model/feature.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Feature(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'entitlment': (str, none_type), # noqa: E501 - 'enabled': (bool, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Feature(BaseModel): + """ + Entitlement feature record. + """ # noqa: E501 + entitlment: Optional[StrictStr] = None + enabled: Optional[StrictBool] = Field(default=None, description="Whether this entitlement is enabled for the user.") + __properties: ClassVar[List[str]] = ["entitlment", "enabled"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'entitlment': 'entitlment', # noqa: E501 - 'enabled': 'enabled', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Feature - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - entitlment (str): [optional] # noqa: E501 - enabled (bool): Whether this entitlement is enabled for the user.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Feature from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Feature - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - entitlment (str): [optional] # noqa: E501 - enabled (bool): Whether this entitlement is enabled for the user.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Feature from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "entitlment": obj.get("entitlment"), + "enabled": obj.get("enabled") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.entitlment: str = None - self.enabled: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/feature_list.py b/symphony/bdk/gen/pod_model/feature_list.py deleted file mode 100644 index 547116f0..00000000 --- a/symphony/bdk/gen/pod_model/feature_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.feature import Feature -globals()['Feature'] = Feature - -class FeatureList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([Feature],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """FeatureList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Feature]): # noqa: E501 - - Keyword Args: - value ([Feature]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[Feature] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """FeatureList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Feature]): # noqa: E501 - - Keyword Args: - value ([Feature]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/file_extension.py b/symphony/bdk/gen/pod_model/file_extension.py index caa68cd6..6884a9df 100644 --- a/symphony/bdk/gen/pod_model/file_extension.py +++ b/symphony/bdk/gen/pod_model/file_extension.py @@ -1,285 +1,105 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class FileExtension(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class FileExtension(BaseModel): """ + FileExtension + """ # noqa: E501 + extension: StrictStr = Field(description="The file extension that this specific record is for. This is a unique ID that allows this record to be referenced in the URI. ") + scope_internal: Optional[StrictBool] = Field(default=None, description="File extension allowed for internal scope ") + scope_external: Optional[StrictBool] = Field(default=None, description="File extension allowed for external scope ") + scope_xpod: Optional[StrictBool] = Field(default=None, description="File extension allowed to be received from another POD ") + source: Optional[StrictStr] = Field(default=None, description="File extension with metadata understood by the system or file extension created by a customer ") + __properties: ClassVar[List[str]] = ["extension", "scope_internal", "scope_external", "scope_xpod", "source"] + + @field_validator('source') + def source_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['SYSTEM', 'CUSTOMER']): + raise ValueError("must be one of enum values ('SYSTEM', 'CUSTOMER')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('source',): { - 'SYSTEM': "SYSTEM", - 'CUSTOMER': "CUSTOMER", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FileExtension from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'extension': (str,), # noqa: E501 - 'scope_internal': (bool, none_type), # noqa: E501 - 'scope_external': (bool, none_type), # noqa: E501 - 'scope_xpod': (bool, none_type), # noqa: E501 - 'source': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - + excluded_fields: Set[str] = set([ + ]) - attribute_map = { - 'extension': 'extension', # noqa: E501 - 'scope_internal': 'scope_internal', # noqa: E501 - 'scope_external': 'scope_external', # noqa: E501 - 'scope_xpod': 'scope_xpod', # noqa: E501 - 'source': 'source', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, extension, *args, **kwargs): # noqa: E501 - """FileExtension - a pod_model defined in OpenAPI - - Args: - extension (str): The file extension that this specific record is for. This is a unique ID that allows this record to be referenced in the URI. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - scope_internal (bool): File extension allowed for internal scope . [optional] # noqa: E501 - scope_external (bool): File extension allowed for external scope . [optional] # noqa: E501 - scope_xpod (bool): File extension allowed to be received from another POD . [optional] # noqa: E501 - source (str): File extension with metadata understood by the system or file extension created by a customer . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.extension = extension - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, extension, *args, **kwargs): # noqa: E501 - """FileExtension - a pod_model defined in OpenAPI - - Args: - extension (str): The file extension that this specific record is for. This is a unique ID that allows this record to be referenced in the URI. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - scope_internal (bool): File extension allowed for internal scope . [optional] # noqa: E501 - scope_external (bool): File extension allowed for external scope . [optional] # noqa: E501 - scope_xpod (bool): File extension allowed to be received from another POD . [optional] # noqa: E501 - source (str): File extension with metadata understood by the system or file extension created by a customer . [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FileExtension from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "extension": obj.get("extension"), + "scope_internal": obj.get("scope_internal"), + "scope_external": obj.get("scope_external"), + "scope_xpod": obj.get("scope_xpod"), + "source": obj.get("source") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.extension: str = extension - self.scope_internal: bool = None - self.scope_external: bool = None - self.scope_xpod: bool = None - self.source: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/file_extensions_response.py b/symphony/bdk/gen/pod_model/file_extensions_response.py index 7f3498ba..18e0bb6c 100644 --- a/symphony/bdk/gen/pod_model/file_extensions_response.py +++ b/symphony/bdk/gen/pod_model/file_extensions_response.py @@ -1,264 +1,95 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List from symphony.bdk.gen.pod_model.file_extension import FileExtension -globals()['FileExtension'] = FileExtension - -class FileExtensionsResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class FileExtensionsResponse(BaseModel): """ + FileExtensionsResponse + """ # noqa: E501 + data: List[FileExtension] + __properties: ClassVar[List[str]] = ["data"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'data': ([FileExtension],), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'data': 'data', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, data, *args, **kwargs): # noqa: E501 - """FileExtensionsResponse - a pod_model defined in OpenAPI - - Args: - data ([FileExtension]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FileExtensionsResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.data = data - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, data, *args, **kwargs): # noqa: E501 - """FileExtensionsResponse - a pod_model defined in OpenAPI - - Args: - data ([FileExtension]): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FileExtensionsResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "data": [FileExtension.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.data: List[FileExtension] = data - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/followers_list.py b/symphony/bdk/gen/pod_model/followers_list.py index 119b5983..6cdab06d 100644 --- a/symphony/bdk/gen/pod_model/followers_list.py +++ b/symphony/bdk/gen/pod_model/followers_list.py @@ -1,259 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.user_id_list import UserIdList -globals()['UserIdList'] = UserIdList - -class FollowersList(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'followers': (UserIdList, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class FollowersList(BaseModel): + """ + FollowersList + """ # noqa: E501 + followers: Optional[List[StrictInt]] = None + __properties: ClassVar[List[str]] = ["followers"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'followers': 'followers', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """FollowersList - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - followers (UserIdList): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FollowersList from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """FollowersList - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - followers (UserIdList): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FollowersList from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "followers": obj.get("followers") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.followers: UserIdList = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/followers_list_response.py b/symphony/bdk/gen/pod_model/followers_list_response.py index 92297aef..9279e749 100644 --- a/symphony/bdk/gen/pod_model/followers_list_response.py +++ b/symphony/bdk/gen/pod_model/followers_list_response.py @@ -1,269 +1,95 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.pagination import Pagination -globals()['Pagination'] = Pagination +from typing import Optional, Set +from typing_extensions import Self -class FollowersListResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class FollowersListResponse(BaseModel): """ + FollowersListResponse + """ # noqa: E501 + count: Optional[StrictInt] = None + followers: Optional[List[StrictInt]] = None + pagination: Optional[Pagination] = None + __properties: ClassVar[List[str]] = ["count", "followers", "pagination"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'count': (int, none_type), # noqa: E501 - 'followers': ([int], none_type), # noqa: E501 - 'pagination': (Pagination, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'count': 'count', # noqa: E501 - 'followers': 'followers', # noqa: E501 - 'pagination': 'pagination', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """FollowersListResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): [optional] # noqa: E501 - followers ([int]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FollowersListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """FollowersListResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): [optional] # noqa: E501 - followers ([int]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FollowersListResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "count": obj.get("count"), + "followers": obj.get("followers"), + "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.count: int = None - self.followers: List[int] = None - self.pagination: Pagination = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/following_list_response.py b/symphony/bdk/gen/pod_model/following_list_response.py index abc0a9c5..8a090362 100644 --- a/symphony/bdk/gen/pod_model/following_list_response.py +++ b/symphony/bdk/gen/pod_model/following_list_response.py @@ -1,269 +1,95 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.pagination import Pagination -globals()['Pagination'] = Pagination +from typing import Optional, Set +from typing_extensions import Self -class FollowingListResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class FollowingListResponse(BaseModel): """ + FollowingListResponse + """ # noqa: E501 + count: Optional[StrictInt] = None + following: Optional[List[StrictInt]] = None + pagination: Optional[Pagination] = None + __properties: ClassVar[List[str]] = ["count", "following", "pagination"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'count': (int, none_type), # noqa: E501 - 'following': ([int], none_type), # noqa: E501 - 'pagination': (Pagination, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'count': 'count', # noqa: E501 - 'following': 'following', # noqa: E501 - 'pagination': 'pagination', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """FollowingListResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): [optional] # noqa: E501 - following ([int]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FollowingListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """FollowingListResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): [optional] # noqa: E501 - following ([int]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FollowingListResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "count": obj.get("count"), + "following": obj.get("following"), + "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.count: int = None - self.following: List[int] = None - self.pagination: Pagination = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/group.py b/symphony/bdk/gen/pod_model/group.py index ecf0c004..10fd2e5b 100644 --- a/symphony/bdk/gen/pod_model/group.py +++ b/symphony/bdk/gen/pod_model/group.py @@ -1,286 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Group(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'member_count': (int, none_type), # noqa: E501 - 'policies': ([str], none_type), # noqa: E501 - 'created_date': (int, none_type), # noqa: E501 - 'modified_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - 'active': 'active', # noqa: E501 - 'member_count': 'memberCount', # noqa: E501 - 'policies': 'policies', # noqa: E501 - 'created_date': 'createdDate', # noqa: E501 - 'modified_date': 'modifiedDate', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class Group(BaseModel): + """ + Information Barrier Group record. + """ # noqa: E501 + id: Optional[StrictStr] = None + name: Optional[StrictStr] = None + active: Optional[StrictBool] = None + member_count: Optional[StrictInt] = Field(default=None, alias="memberCount") + policies: Optional[List[StrictStr]] = None + created_date: Optional[StrictInt] = Field(default=None, alias="createdDate") + modified_date: Optional[StrictInt] = Field(default=None, alias="modifiedDate") + __properties: ClassVar[List[str]] = ["id", "name", "active", "memberCount", "policies", "createdDate", "modifiedDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Group - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Group from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - active (bool): [optional] # noqa: E501 - member_count (int): [optional] # noqa: E501 - policies ([str]): [optional] # noqa: E501 - created_date (int): [optional] # noqa: E501 - modified_date (int): [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Group - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - active (bool): [optional] # noqa: E501 - member_count (int): [optional] # noqa: E501 - policies ([str]): [optional] # noqa: E501 - created_date (int): [optional] # noqa: E501 - modified_date (int): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Group from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "active": obj.get("active"), + "memberCount": obj.get("memberCount"), + "policies": obj.get("policies"), + "createdDate": obj.get("createdDate"), + "modifiedDate": obj.get("modifiedDate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.name: str = None - self.active: bool = None - self.member_count: int = None - self.policies: List[str] = None - self.created_date: int = None - self.modified_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/group_item.py b/symphony/bdk/gen/pod_model/group_item.py index 67da4027..7bcaa890 100644 --- a/symphony/bdk/gen/pod_model/group_item.py +++ b/symphony/bdk/gen/pod_model/group_item.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class GroupItem(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (int, none_type), # noqa: E501 - 'added_by': (int, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class GroupItem(BaseModel): + """ + GroupItem + """ # noqa: E501 + id: Optional[StrictInt] = Field(default=None, description="The ID of the added group (aka SDL).") + added_by: Optional[StrictInt] = Field(default=None, description="The user ID who added the group to the room.", alias="addedBy") + __properties: ClassVar[List[str]] = ["id", "addedBy"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - 'added_by': 'addedBy', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """GroupItem - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): The ID of the added group (aka SDL).. [optional] # noqa: E501 - added_by (int): The user ID who added the group to the room.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GroupItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """GroupItem - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): The ID of the added group (aka SDL).. [optional] # noqa: E501 - added_by (int): The user ID who added the group to the room.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GroupItem from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "addedBy": obj.get("addedBy") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: int = None - self.added_by: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/group_list.py b/symphony/bdk/gen/pod_model/group_list.py deleted file mode 100644 index f25df70d..00000000 --- a/symphony/bdk/gen/pod_model/group_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.group import Group -globals()['Group'] = Group - -class GroupList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([Group],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """GroupList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Group]): # noqa: E501 - - Keyword Args: - value ([Group]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[Group] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """GroupList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Group]): # noqa: E501 - - Keyword Args: - value ([Group]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/group_role_scope.py b/symphony/bdk/gen/pod_model/group_role_scope.py index 8692219d..6d6f0ff0 100644 --- a/symphony/bdk/gen/pod_model/group_role_scope.py +++ b/symphony/bdk/gen/pod_model/group_role_scope.py @@ -1,276 +1,95 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class GroupRoleScope(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class GroupRoleScope(BaseModel): """ + User Group info to include in other models + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Group ID") + name: Optional[StrictStr] = Field(default=None, description="Group name") + area: Optional[StrictStr] = Field(default=None, description="An optional string attribute used for categorizing groups") + type: Optional[StrictStr] = Field(default=None, description="Group type") + active: Optional[StrictBool] = Field(default=None, description="Group status") + __properties: ClassVar[List[str]] = ["id", "name", "area", "type", "active"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GroupRoleScope from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (str, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'area': (str, none_type), # noqa: E501 - 'type': (str, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - 'area': 'area', # noqa: E501 - 'type': 'type', # noqa: E501 - 'active': 'active', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """GroupRoleScope - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group ID. [optional] # noqa: E501 - name (str): Group name. [optional] # noqa: E501 - area (str): An optional string attribute used for categorizing groups. [optional] # noqa: E501 - type (str): Group type. [optional] # noqa: E501 - active (bool): Group status. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """GroupRoleScope - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group ID. [optional] # noqa: E501 - name (str): Group name. [optional] # noqa: E501 - area (str): An optional string attribute used for categorizing groups. [optional] # noqa: E501 - type (str): Group type. [optional] # noqa: E501 - active (bool): Group status. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GroupRoleScope from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "area": obj.get("area"), + "type": obj.get("type"), + "active": obj.get("active") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.name: str = None - self.area: str = None - self.type: str = None - self.active: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/im_system_info.py b/symphony/bdk/gen/pod_model/im_system_info.py index 2759bc74..198b8f43 100644 --- a/symphony/bdk/gen/pod_model/im_system_info.py +++ b/symphony/bdk/gen/pod_model/im_system_info.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class IMSystemInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'creation_date': (int, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class IMSystemInfo(BaseModel): + """ + IMSystemInfo + """ # noqa: E501 + id: Optional[StrictStr] = None + creation_date: Optional[StrictInt] = Field(default=None, description="The datetime when the stream was originally created. Milliseconds since Jan 1 1970.", alias="creationDate") + active: Optional[StrictBool] = Field(default=None, description="If false, no messages can be sent in this stream, and membership is locked.") + __properties: ClassVar[List[str]] = ["id", "creationDate", "active"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - 'creation_date': 'creationDate', # noqa: E501 - 'active': 'active', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """IMSystemInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - creation_date (int): The datetime when the stream was originally created. Milliseconds since Jan 1 1970.. [optional] # noqa: E501 - active (bool): If false, no messages can be sent in this stream, and membership is locked.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of IMSystemInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """IMSystemInfo - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - creation_date (int): The datetime when the stream was originally created. Milliseconds since Jan 1 1970.. [optional] # noqa: E501 - active (bool): If false, no messages can be sent in this stream, and membership is locked.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of IMSystemInfo from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "creationDate": obj.get("creationDate"), + "active": obj.get("active") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.creation_date: int = None - self.active: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/immutable_room_attributes.py b/symphony/bdk/gen/pod_model/immutable_room_attributes.py index d643953a..c4900a3a 100644 --- a/symphony/bdk/gen/pod_model/immutable_room_attributes.py +++ b/symphony/bdk/gen/pod_model/immutable_room_attributes.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class ImmutableRoomAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'public': (bool, none_type), # noqa: E501 - 'read_only': (bool, none_type), # noqa: E501 - 'copy_protected': (bool, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class ImmutableRoomAttributes(BaseModel): + """ + These attributes cannot be changed once the room has been created + """ # noqa: E501 + public: Optional[StrictBool] = Field(default=None, description="If true, this is a public chatroom. IF false, a private chatroom.") + read_only: Optional[StrictBool] = Field(default=None, description="If true, only stream owners can send messages.", alias="readOnly") + copy_protected: Optional[StrictBool] = Field(default=None, description="If true, clients disable the clipboard copy for content in this stream.", alias="copyProtected") + __properties: ClassVar[List[str]] = ["public", "readOnly", "copyProtected"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'public': 'public', # noqa: E501 - 'read_only': 'readOnly', # noqa: E501 - 'copy_protected': 'copyProtected', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ImmutableRoomAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - public (bool): If true, this is a public chatroom. IF false, a private chatroom.. [optional] # noqa: E501 - read_only (bool): If true, only stream owners can send messages.. [optional] # noqa: E501 - copy_protected (bool): If true, clients disable the clipboard copy for content in this stream.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ImmutableRoomAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """ImmutableRoomAttributes - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - public (bool): If true, this is a public chatroom. IF false, a private chatroom.. [optional] # noqa: E501 - read_only (bool): If true, only stream owners can send messages.. [optional] # noqa: E501 - copy_protected (bool): If true, clients disable the clipboard copy for content in this stream.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ImmutableRoomAttributes from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "public": obj.get("public"), + "readOnly": obj.get("readOnly"), + "copyProtected": obj.get("copyProtected") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.public: bool = None - self.read_only: bool = None - self.copy_protected: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/integer_list.py b/symphony/bdk/gen/pod_model/integer_list.py deleted file mode 100644 index f6baa794..00000000 --- a/symphony/bdk/gen/pod_model/integer_list.py +++ /dev/null @@ -1,278 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class IntegerList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([int],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """IntegerList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([int]): # noqa: E501 - - Keyword Args: - value ([int]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[int] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """IntegerList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([int]): # noqa: E501 - - Keyword Args: - value ([int]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/languages.py b/symphony/bdk/gen/pod_model/languages.py index 1b4237d6..080003e5 100644 --- a/symphony/bdk/gen/pod_model/languages.py +++ b/symphony/bdk/gen/pod_model/languages.py @@ -1,259 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.string_list import StringList -globals()['StringList'] = StringList - -class Languages(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'languages': (StringList, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Languages(BaseModel): + """ + List of languages + """ # noqa: E501 + languages: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["languages"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'languages': 'languages', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Languages - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - languages (StringList): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Languages from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Languages - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - languages (StringList): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Languages from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "languages": obj.get("languages") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.languages: StringList = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/member_info.py b/symphony/bdk/gen/pod_model/member_info.py index 07a7bf49..1d9e7734 100644 --- a/symphony/bdk/gen/pod_model/member_info.py +++ b/symphony/bdk/gen/pod_model/member_info.py @@ -1,271 +1,93 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class MemberInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class MemberInfo(BaseModel): """ + Detailed membership record. + """ # noqa: E501 + id: Optional[StrictInt] = None + owner: Optional[StrictBool] = None + join_date: Optional[StrictInt] = Field(default=None, alias="joinDate") + added_through_groups: Optional[List[StrictInt]] = Field(default=None, description="When the user has been added to the stream through a group (aka SDL), this array contains the group ID which the user belongs to. Since SBE 20.14.", alias="addedThroughGroups") + __properties: ClassVar[List[str]] = ["id", "owner", "joinDate", "addedThroughGroups"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MemberInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (int, none_type), # noqa: E501 - 'owner': (bool, none_type), # noqa: E501 - 'join_date': (int, none_type), # noqa: E501 - 'added_through_groups': ([int], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'id': 'id', # noqa: E501 - 'owner': 'owner', # noqa: E501 - 'join_date': 'joinDate', # noqa: E501 - 'added_through_groups': 'addedThroughGroups', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MemberInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - owner (bool): [optional] # noqa: E501 - join_date (int): [optional] # noqa: E501 - added_through_groups ([int]): When the user has been added to the stream through a group (aka SDL), this array contains the group ID which the user belongs to. Since SBE 20.14.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MemberInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - owner (bool): [optional] # noqa: E501 - join_date (int): [optional] # noqa: E501 - added_through_groups ([int]): When the user has been added to the stream through a group (aka SDL), this array contains the group ID which the user belongs to. Since SBE 20.14.. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MemberInfo from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "owner": obj.get("owner"), + "joinDate": obj.get("joinDate"), + "addedThroughGroups": obj.get("addedThroughGroups") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: int = None - self.owner: bool = None - self.join_date: int = None - self.added_through_groups: List[int] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/membership_data.py b/symphony/bdk/gen/pod_model/membership_data.py index f0ae83ff..d1c919a7 100644 --- a/symphony/bdk/gen/pod_model/membership_data.py +++ b/symphony/bdk/gen/pod_model/membership_data.py @@ -1,276 +1,95 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class MembershipData(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class MembershipData(BaseModel): """ + User object response + """ # noqa: E501 + id: Optional[StrictInt] = None + user_name: Optional[StrictStr] = Field(default=None, alias="userName") + first_name: Optional[StrictStr] = Field(default=None, alias="firstName") + last_name: Optional[StrictStr] = Field(default=None, alias="lastName") + email_address: Optional[StrictStr] = Field(default=None, alias="emailAddress") + __properties: ClassVar[List[str]] = ["id", "userName", "firstName", "lastName", "emailAddress"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MembershipData from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (int, none_type), # noqa: E501 - 'user_name': (str, none_type), # noqa: E501 - 'first_name': (str, none_type), # noqa: E501 - 'last_name': (str, none_type), # noqa: E501 - 'email_address': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'id': 'id', # noqa: E501 - 'user_name': 'userName', # noqa: E501 - 'first_name': 'firstName', # noqa: E501 - 'last_name': 'lastName', # noqa: E501 - 'email_address': 'emailAddress', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MembershipData - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - user_name (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - email_address (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MembershipData - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - user_name (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - email_address (str): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MembershipData from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "userName": obj.get("userName"), + "firstName": obj.get("firstName"), + "lastName": obj.get("lastName"), + "emailAddress": obj.get("emailAddress") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: int = None - self.user_name: str = None - self.first_name: str = None - self.last_name: str = None - self.email_address: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/membership_list.py b/symphony/bdk/gen/pod_model/membership_list.py deleted file mode 100644 index 61229d05..00000000 --- a/symphony/bdk/gen/pod_model/membership_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.member_info import MemberInfo -globals()['MemberInfo'] = MemberInfo - -class MembershipList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([MemberInfo],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """MembershipList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([MemberInfo]): List of members in a room.. # noqa: E501 - - Keyword Args: - value ([MemberInfo]): List of members in a room.. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[MemberInfo] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """MembershipList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([MemberInfo]): List of members in a room.. # noqa: E501 - - Keyword Args: - value ([MemberInfo]): List of members in a room.. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/message_detail.py b/symphony/bdk/gen/pod_model/message_detail.py index 01670b8a..9ae9af95 100644 --- a/symphony/bdk/gen/pod_model/message_detail.py +++ b/symphony/bdk/gen/pod_model/message_detail.py @@ -1,303 +1,122 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.message_download_receipt_count import MessageDownloadReceiptCount from symphony.bdk.gen.pod_model.message_stream import MessageStream from symphony.bdk.gen.pod_model.message_user import MessageUser -globals()['MessageDownloadReceiptCount'] = MessageDownloadReceiptCount -globals()['MessageStream'] = MessageStream -globals()['MessageUser'] = MessageUser - -class MessageDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class MessageDetail(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message_id': (str, none_type), # noqa: E501 - 'creator': (MessageUser, none_type), # noqa: E501 - 'on_behalf_of_user': (MessageUser, none_type), # noqa: E501 - 'stream': (MessageStream, none_type), # noqa: E501 - 'creation_date': (int, none_type), # noqa: E501 - 'delivery_receipt_count': (int, none_type), # noqa: E501 - 'read_receipt_count': (int, none_type), # noqa: E501 - 'email_notification_count': (int, none_type), # noqa: E501 - 'download_receipt_counts': ([MessageDownloadReceiptCount], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message_id': 'messageId', # noqa: E501 - 'creator': 'creator', # noqa: E501 - 'on_behalf_of_user': 'onBehalfOfUser', # noqa: E501 - 'stream': 'stream', # noqa: E501 - 'creation_date': 'creationDate', # noqa: E501 - 'delivery_receipt_count': 'deliveryReceiptCount', # noqa: E501 - 'read_receipt_count': 'readReceiptCount', # noqa: E501 - 'email_notification_count': 'emailNotificationCount', # noqa: E501 - 'download_receipt_counts': 'downloadReceiptCounts', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + Message detail + """ # noqa: E501 + message_id: Optional[StrictStr] = Field(default=None, description="message id", alias="messageId") + creator: Optional[MessageUser] = None + on_behalf_of_user: Optional[MessageUser] = Field(default=None, alias="onBehalfOfUser") + stream: Optional[MessageStream] = None + creation_date: Optional[StrictInt] = Field(default=None, alias="creationDate") + delivery_receipt_count: Optional[StrictInt] = Field(default=None, alias="deliveryReceiptCount") + read_receipt_count: Optional[StrictInt] = Field(default=None, alias="readReceiptCount") + email_notification_count: Optional[StrictInt] = Field(default=None, alias="emailNotificationCount") + download_receipt_counts: Optional[List[MessageDownloadReceiptCount]] = Field(default=None, alias="downloadReceiptCounts") + __properties: ClassVar[List[str]] = ["messageId", "creator", "onBehalfOfUser", "stream", "creationDate", "deliveryReceiptCount", "readReceiptCount", "emailNotificationCount", "downloadReceiptCounts"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): message id. [optional] # noqa: E501 - creator (MessageUser): [optional] # noqa: E501 - on_behalf_of_user (MessageUser): [optional] # noqa: E501 - stream (MessageStream): [optional] # noqa: E501 - creation_date (int): [optional] # noqa: E501 - delivery_receipt_count (int): [optional] # noqa: E501 - read_receipt_count (int): [optional] # noqa: E501 - email_notification_count (int): [optional] # noqa: E501 - download_receipt_counts ([MessageDownloadReceiptCount]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): message id. [optional] # noqa: E501 - creator (MessageUser): [optional] # noqa: E501 - on_behalf_of_user (MessageUser): [optional] # noqa: E501 - stream (MessageStream): [optional] # noqa: E501 - creation_date (int): [optional] # noqa: E501 - delivery_receipt_count (int): [optional] # noqa: E501 - read_receipt_count (int): [optional] # noqa: E501 - email_notification_count (int): [optional] # noqa: E501 - download_receipt_counts ([MessageDownloadReceiptCount]): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of creator + if self.creator: + _dict['creator'] = self.creator.to_dict() + # override the default output from pydantic by calling `to_dict()` of on_behalf_of_user + if self.on_behalf_of_user: + _dict['onBehalfOfUser'] = self.on_behalf_of_user.to_dict() + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in download_receipt_counts (list) + _items = [] + if self.download_receipt_counts: + for _item_download_receipt_counts in self.download_receipt_counts: + if _item_download_receipt_counts: + _items.append(_item_download_receipt_counts.to_dict()) + _dict['downloadReceiptCounts'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "messageId": obj.get("messageId"), + "creator": MessageUser.from_dict(obj["creator"]) if obj.get("creator") is not None else None, + "onBehalfOfUser": MessageUser.from_dict(obj["onBehalfOfUser"]) if obj.get("onBehalfOfUser") is not None else None, + "stream": MessageStream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "creationDate": obj.get("creationDate"), + "deliveryReceiptCount": obj.get("deliveryReceiptCount"), + "readReceiptCount": obj.get("readReceiptCount"), + "emailNotificationCount": obj.get("emailNotificationCount"), + "downloadReceiptCounts": [MessageDownloadReceiptCount.from_dict(_item) for _item in obj["downloadReceiptCounts"]] if obj.get("downloadReceiptCounts") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message_id: str = None - self.creator: MessageUser = None - self.on_behalf_of_user: MessageUser = None - self.stream: MessageStream = None - self.creation_date: int = None - self.delivery_receipt_count: int = None - self.read_receipt_count: int = None - self.email_notification_count: int = None - self.download_receipt_counts: List[MessageDownloadReceiptCount] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/message_details.py b/symphony/bdk/gen/pod_model/message_details.py deleted file mode 100644 index 1bbd0fa8..00000000 --- a/symphony/bdk/gen/pod_model/message_details.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.message_detail import MessageDetail -globals()['MessageDetail'] = MessageDetail - -class MessageDetails(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([MessageDetail],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """MessageDetails - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([MessageDetail]): Message details. # noqa: E501 - - Keyword Args: - value ([MessageDetail]): Message details. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[MessageDetail] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """MessageDetails - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([MessageDetail]): Message details. # noqa: E501 - - Keyword Args: - value ([MessageDetail]): Message details. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/message_download_receipt_count.py b/symphony/bdk/gen/pod_model/message_download_receipt_count.py index 5aecb878..8c0b1954 100644 --- a/symphony/bdk/gen/pod_model/message_download_receipt_count.py +++ b/symphony/bdk/gen/pod_model/message_download_receipt_count.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class MessageDownloadReceiptCount(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'file_name': (str, none_type), # noqa: E501 - 'count': (int, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class MessageDownloadReceiptCount(BaseModel): + """ + MessageDownloadReceiptCount + """ # noqa: E501 + file_name: Optional[StrictStr] = Field(default=None, alias="fileName") + count: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["fileName", "count"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'file_name': 'fileName', # noqa: E501 - 'count': 'count', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageDownloadReceiptCount - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - file_name (str): [optional] # noqa: E501 - count (int): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageDownloadReceiptCount from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageDownloadReceiptCount - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - file_name (str): [optional] # noqa: E501 - count (int): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageDownloadReceiptCount from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "fileName": obj.get("fileName"), + "count": obj.get("count") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.file_name: str = None - self.count: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/message_ids.py b/symphony/bdk/gen/pod_model/message_ids.py index dfd0a287..ead9f498 100644 --- a/symphony/bdk/gen/pod_model/message_ids.py +++ b/symphony/bdk/gen/pod_model/message_ids.py @@ -1,259 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.string_list import StringList -globals()['StringList'] = StringList - -class MessageIds(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message_ids': (StringList, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class MessageIds(BaseModel): + """ + MessageIds + """ # noqa: E501 + message_ids: Optional[List[StrictStr]] = Field(default=None, alias="messageIds") + __properties: ClassVar[List[str]] = ["messageIds"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'message_ids': 'messageIds', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageIds - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_ids (StringList): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageIds from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageIds - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_ids (StringList): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageIds from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "messageIds": obj.get("messageIds") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message_ids: StringList = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/message_ids_from_stream.py b/symphony/bdk/gen/pod_model/message_ids_from_stream.py deleted file mode 100644 index 279b68fd..00000000 --- a/symphony/bdk/gen/pod_model/message_ids_from_stream.py +++ /dev/null @@ -1,179 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - - -class MessageIdsFromStream(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'data': ([str], none_type), # noqa: E501 - 'total_number_found': (int, none_type), # noqa: E501 - 'number_returned': (int, none_type), # noqa: E501 - 'next_start_number': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'data': 'Data', # noqa: E501 - 'total_number_found': 'TotalNumberFound', # noqa: E501 - 'number_returned': 'numberReturned', # noqa: E501 - 'next_start_number': 'nextStartNumber', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageIdsFromStream - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data ([str]): [optional] # noqa: E501 - total_number_found (int): [optional] # noqa: E501 - number_returned (int): [optional] # noqa: E501 - next_start_number (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.data: List[str] = None - self.total_number_found: int = None - self.number_returned: int = None - self.next_start_number: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/message_metadata_response.py b/symphony/bdk/gen/pod_model/message_metadata_response.py index 3c32c031..3c7c195c 100644 --- a/symphony/bdk/gen/pod_model/message_metadata_response.py +++ b/symphony/bdk/gen/pod_model/message_metadata_response.py @@ -1,279 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.message_metadata_response_parent import MessageMetadataResponseParent -globals()['MessageMetadataResponseParent'] = MessageMetadataResponseParent - -class MessageMetadataResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class MessageMetadataResponse(BaseModel): """ + Message metadata + """ # noqa: E501 + message_id: Optional[StrictStr] = Field(default=None, alias="messageId") + parent: Optional[MessageMetadataResponseParent] = None + replies: Optional[List[StrictStr]] = None + forwards: Optional[List[StrictStr]] = None + form_replies: Optional[List[StrictStr]] = Field(default=None, alias="formReplies") + __properties: ClassVar[List[str]] = ["messageId", "parent", "replies", "forwards", "formReplies"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageMetadataResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'message_id': (str, none_type), # noqa: E501 - 'parent': (MessageMetadataResponseParent, none_type), # noqa: E501 - 'replies': ([str], none_type), # noqa: E501 - 'forwards': ([str], none_type), # noqa: E501 - 'form_replies': ([str], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message_id': 'messageId', # noqa: E501 - 'parent': 'parent', # noqa: E501 - 'replies': 'replies', # noqa: E501 - 'forwards': 'forwards', # noqa: E501 - 'form_replies': 'formReplies', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of parent + if self.parent: + _dict['parent'] = self.parent.to_dict() + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageMetadataResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): [optional] # noqa: E501 - parent (MessageMetadataResponseParent): [optional] # noqa: E501 - replies ([str]): [optional] # noqa: E501 - forwards ([str]): [optional] # noqa: E501 - form_replies ([str]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageMetadataResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): [optional] # noqa: E501 - parent (MessageMetadataResponseParent): [optional] # noqa: E501 - replies ([str]): [optional] # noqa: E501 - forwards ([str]): [optional] # noqa: E501 - form_replies ([str]): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageMetadataResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "messageId": obj.get("messageId"), + "parent": MessageMetadataResponseParent.from_dict(obj["parent"]) if obj.get("parent") is not None else None, + "replies": obj.get("replies"), + "forwards": obj.get("forwards"), + "formReplies": obj.get("formReplies") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message_id: str = None - self.parent: MessageMetadataResponseParent = None - self.replies: List[str] = None - self.forwards: List[str] = None - self.form_replies: List[str] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/message_metadata_response_parent.py b/symphony/bdk/gen/pod_model/message_metadata_response_parent.py index 1ddc2b84..a446869c 100644 --- a/symphony/bdk/gen/pod_model/message_metadata_response_parent.py +++ b/symphony/bdk/gen/pod_model/message_metadata_response_parent.py @@ -1,266 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class MessageMetadataResponseParent(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class MessageMetadataResponseParent(BaseModel): """ + MessageMetadataResponseParent + """ # noqa: E501 + message_id: Optional[StrictStr] = Field(default=None, description="Id of the parent message queried", alias="messageId") + relationship_type: Optional[StrictStr] = Field(default=None, alias="relationshipType") + __properties: ClassVar[List[str]] = ["messageId", "relationshipType"] + + @field_validator('relationship_type') + def relationship_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['REPLY_FORM', 'REPLY', 'FORWARD']): + raise ValueError("must be one of enum values ('REPLY_FORM', 'REPLY', 'FORWARD')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('relationship_type',): { - 'REPLY_FORM': "REPLY_FORM", - 'REPLY': "REPLY", - 'FORWARD': "FORWARD", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageMetadataResponseParent from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'message_id': (str, none_type), # noqa: E501 - 'relationship_type': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'message_id': 'messageId', # noqa: E501 - 'relationship_type': 'relationshipType', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageMetadataResponseParent - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): Id of the parent message queried. [optional] # noqa: E501 - relationship_type (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageMetadataResponseParent - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): Id of the parent message queried. [optional] # noqa: E501 - relationship_type (str): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageMetadataResponseParent from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "messageId": obj.get("messageId"), + "relationshipType": obj.get("relationshipType") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message_id: str = None - self.relationship_type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/message_receipt_detail.py b/symphony/bdk/gen/pod_model/message_receipt_detail.py index 9a1b9351..be708b19 100644 --- a/symphony/bdk/gen/pod_model/message_receipt_detail.py +++ b/symphony/bdk/gen/pod_model/message_receipt_detail.py @@ -1,281 +1,107 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.download_receipt_count import DownloadReceiptCount from symphony.bdk.gen.pod_model.user_compp import UserCompp -globals()['DownloadReceiptCount'] = DownloadReceiptCount -globals()['UserCompp'] = UserCompp - -class MessageReceiptDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class MessageReceiptDetail(BaseModel): """ + Message receipt details response object + """ # noqa: E501 + user: Optional[UserCompp] = None + delivery_receipt_timestamp: Optional[StrictInt] = Field(default=None, description="Timestamp of message delivery receipts", alias="deliveryReceiptTimestamp") + read_receipt_timestamp: Optional[StrictInt] = Field(default=None, description="Timestamp of message read receipts", alias="readReceiptTimestamp") + email_notification_timestamp: Optional[StrictInt] = Field(default=None, description="Timestamp of message email notifications", alias="emailNotificationTimestamp") + download_receipt_counts: Optional[List[DownloadReceiptCount]] = Field(default=None, alias="downloadReceiptCounts") + __properties: ClassVar[List[str]] = ["user", "deliveryReceiptTimestamp", "readReceiptTimestamp", "emailNotificationTimestamp", "downloadReceiptCounts"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageReceiptDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'user': (UserCompp, none_type), # noqa: E501 - 'delivery_receipt_timestamp': (int, none_type), # noqa: E501 - 'read_receipt_timestamp': (int, none_type), # noqa: E501 - 'email_notification_timestamp': (int, none_type), # noqa: E501 - 'download_receipt_counts': ([DownloadReceiptCount], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user': 'user', # noqa: E501 - 'delivery_receipt_timestamp': 'deliveryReceiptTimestamp', # noqa: E501 - 'read_receipt_timestamp': 'readReceiptTimestamp', # noqa: E501 - 'email_notification_timestamp': 'emailNotificationTimestamp', # noqa: E501 - 'download_receipt_counts': 'downloadReceiptCounts', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in download_receipt_counts (list) + _items = [] + if self.download_receipt_counts: + for _item_download_receipt_counts in self.download_receipt_counts: + if _item_download_receipt_counts: + _items.append(_item_download_receipt_counts.to_dict()) + _dict['downloadReceiptCounts'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageReceiptDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user (UserCompp): [optional] # noqa: E501 - delivery_receipt_timestamp (int): Timestamp of message delivery receipts. [optional] # noqa: E501 - read_receipt_timestamp (int): Timestamp of message read receipts. [optional] # noqa: E501 - email_notification_timestamp (int): Timestamp of message email notifications. [optional] # noqa: E501 - download_receipt_counts ([DownloadReceiptCount]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageReceiptDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user (UserCompp): [optional] # noqa: E501 - delivery_receipt_timestamp (int): Timestamp of message delivery receipts. [optional] # noqa: E501 - read_receipt_timestamp (int): Timestamp of message read receipts. [optional] # noqa: E501 - email_notification_timestamp (int): Timestamp of message email notifications. [optional] # noqa: E501 - download_receipt_counts ([DownloadReceiptCount]): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageReceiptDetail from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "user": UserCompp.from_dict(obj["user"]) if obj.get("user") is not None else None, + "deliveryReceiptTimestamp": obj.get("deliveryReceiptTimestamp"), + "readReceiptTimestamp": obj.get("readReceiptTimestamp"), + "emailNotificationTimestamp": obj.get("emailNotificationTimestamp"), + "downloadReceiptCounts": [DownloadReceiptCount.from_dict(_item) for _item in obj["downloadReceiptCounts"]] if obj.get("downloadReceiptCounts") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user: UserCompp = None - self.delivery_receipt_timestamp: int = None - self.read_receipt_timestamp: int = None - self.email_notification_timestamp: int = None - self.download_receipt_counts: List[DownloadReceiptCount] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/message_receipt_detail_response.py b/symphony/bdk/gen/pod_model/message_receipt_detail_response.py index 9189f6a4..a939157a 100644 --- a/symphony/bdk/gen/pod_model/message_receipt_detail_response.py +++ b/symphony/bdk/gen/pod_model/message_receipt_detail_response.py @@ -1,312 +1,136 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.message_download_receipt_count import MessageDownloadReceiptCount from symphony.bdk.gen.pod_model.message_receipt_detail import MessageReceiptDetail from symphony.bdk.gen.pod_model.message_stream import MessageStream from symphony.bdk.gen.pod_model.message_user import MessageUser from symphony.bdk.gen.pod_model.pagination import Pagination -globals()['MessageDownloadReceiptCount'] = MessageDownloadReceiptCount -globals()['MessageReceiptDetail'] = MessageReceiptDetail -globals()['MessageStream'] = MessageStream -globals()['MessageUser'] = MessageUser -globals()['Pagination'] = Pagination - -class MessageReceiptDetailResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class MessageReceiptDetailResponse(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'creator': (MessageUser, none_type), # noqa: E501 - 'on_behalf_of_user': (MessageUser, none_type), # noqa: E501 - 'stream': (MessageStream, none_type), # noqa: E501 - 'creation_date': (int, none_type), # noqa: E501 - 'delivery_receipt_count': (int, none_type), # noqa: E501 - 'read_receipt_count': (int, none_type), # noqa: E501 - 'email_notification_count': (int, none_type), # noqa: E501 - 'download_receipt_counts': ([MessageDownloadReceiptCount], none_type), # noqa: E501 - 'message_receipt_detail': ([MessageReceiptDetail], none_type), # noqa: E501 - 'pagination': (Pagination, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'creator': 'creator', # noqa: E501 - 'on_behalf_of_user': 'onBehalfOfUser', # noqa: E501 - 'stream': 'stream', # noqa: E501 - 'creation_date': 'creationDate', # noqa: E501 - 'delivery_receipt_count': 'deliveryReceiptCount', # noqa: E501 - 'read_receipt_count': 'readReceiptCount', # noqa: E501 - 'email_notification_count': 'emailNotificationCount', # noqa: E501 - 'download_receipt_counts': 'downloadReceiptCounts', # noqa: E501 - 'message_receipt_detail': 'MessageReceiptDetail', # noqa: E501 - 'pagination': 'pagination', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + List of Message receipt details + """ # noqa: E501 + creator: Optional[MessageUser] = None + on_behalf_of_user: Optional[MessageUser] = Field(default=None, alias="onBehalfOfUser") + stream: Optional[MessageStream] = None + creation_date: Optional[StrictInt] = Field(default=None, alias="creationDate") + delivery_receipt_count: Optional[StrictInt] = Field(default=None, alias="deliveryReceiptCount") + read_receipt_count: Optional[StrictInt] = Field(default=None, alias="readReceiptCount") + email_notification_count: Optional[StrictInt] = Field(default=None, alias="emailNotificationCount") + download_receipt_counts: Optional[List[MessageDownloadReceiptCount]] = Field(default=None, alias="downloadReceiptCounts") + message_receipt_detail: Optional[List[MessageReceiptDetail]] = Field(default=None, alias="MessageReceiptDetail") + pagination: Optional[Pagination] = None + __properties: ClassVar[List[str]] = ["creator", "onBehalfOfUser", "stream", "creationDate", "deliveryReceiptCount", "readReceiptCount", "emailNotificationCount", "downloadReceiptCounts", "MessageReceiptDetail", "pagination"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageReceiptDetailResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - creator (MessageUser): [optional] # noqa: E501 - on_behalf_of_user (MessageUser): [optional] # noqa: E501 - stream (MessageStream): [optional] # noqa: E501 - creation_date (int): [optional] # noqa: E501 - delivery_receipt_count (int): [optional] # noqa: E501 - read_receipt_count (int): [optional] # noqa: E501 - email_notification_count (int): [optional] # noqa: E501 - download_receipt_counts ([MessageDownloadReceiptCount]): [optional] # noqa: E501 - message_receipt_detail ([MessageReceiptDetail]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageReceiptDetailResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageReceiptDetailResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - creator (MessageUser): [optional] # noqa: E501 - on_behalf_of_user (MessageUser): [optional] # noqa: E501 - stream (MessageStream): [optional] # noqa: E501 - creation_date (int): [optional] # noqa: E501 - delivery_receipt_count (int): [optional] # noqa: E501 - read_receipt_count (int): [optional] # noqa: E501 - email_notification_count (int): [optional] # noqa: E501 - download_receipt_counts ([MessageDownloadReceiptCount]): [optional] # noqa: E501 - message_receipt_detail ([MessageReceiptDetail]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of creator + if self.creator: + _dict['creator'] = self.creator.to_dict() + # override the default output from pydantic by calling `to_dict()` of on_behalf_of_user + if self.on_behalf_of_user: + _dict['onBehalfOfUser'] = self.on_behalf_of_user.to_dict() + # override the default output from pydantic by calling `to_dict()` of stream + if self.stream: + _dict['stream'] = self.stream.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in download_receipt_counts (list) + _items = [] + if self.download_receipt_counts: + for _item_download_receipt_counts in self.download_receipt_counts: + if _item_download_receipt_counts: + _items.append(_item_download_receipt_counts.to_dict()) + _dict['downloadReceiptCounts'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in message_receipt_detail (list) + _items = [] + if self.message_receipt_detail: + for _item_message_receipt_detail in self.message_receipt_detail: + if _item_message_receipt_detail: + _items.append(_item_message_receipt_detail.to_dict()) + _dict['MessageReceiptDetail'] = _items + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageReceiptDetailResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "creator": MessageUser.from_dict(obj["creator"]) if obj.get("creator") is not None else None, + "onBehalfOfUser": MessageUser.from_dict(obj["onBehalfOfUser"]) if obj.get("onBehalfOfUser") is not None else None, + "stream": MessageStream.from_dict(obj["stream"]) if obj.get("stream") is not None else None, + "creationDate": obj.get("creationDate"), + "deliveryReceiptCount": obj.get("deliveryReceiptCount"), + "readReceiptCount": obj.get("readReceiptCount"), + "emailNotificationCount": obj.get("emailNotificationCount"), + "downloadReceiptCounts": [MessageDownloadReceiptCount.from_dict(_item) for _item in obj["downloadReceiptCounts"]] if obj.get("downloadReceiptCounts") is not None else None, + "MessageReceiptDetail": [MessageReceiptDetail.from_dict(_item) for _item in obj["MessageReceiptDetail"]] if obj.get("MessageReceiptDetail") is not None else None, + "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.creator: MessageUser = None - self.on_behalf_of_user: MessageUser = None - self.stream: MessageStream = None - self.creation_date: int = None - self.delivery_receipt_count: int = None - self.read_receipt_count: int = None - self.email_notification_count: int = None - self.download_receipt_counts: List[MessageDownloadReceiptCount] = None - self.message_receipt_detail: List[MessageReceiptDetail] = None - self.pagination: Pagination = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/message_status.py b/symphony/bdk/gen/pod_model/message_status.py index dbe6eab4..a77a90ec 100644 --- a/symphony/bdk/gen/pod_model/message_status.py +++ b/symphony/bdk/gen/pod_model/message_status.py @@ -1,274 +1,118 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.message_status_user import MessageStatusUser -globals()['MessageStatusUser'] = MessageStatusUser - -class MessageStatus(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class MessageStatus(BaseModel): """ + Holds the status of a particular message, indicating which user the message has been sent, delivered or read. + """ # noqa: E501 + author: Optional[MessageStatusUser] = None + read: Optional[List[MessageStatusUser]] = Field(default=None, description="All users who have read that message, in any Symphony client.") + delivered: Optional[List[MessageStatusUser]] = Field(default=None, description="All users who have at least one Symphony client to which the message has been delivered, and not read yet. ") + sent: Optional[List[MessageStatusUser]] = Field(default=None, description="All users to whom the message has been sent and received by the Symphony system, but not yet delivered to any user's Symphony client. ") + __properties: ClassVar[List[str]] = ["author", "read", "delivered", "sent"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'author': (MessageStatusUser, none_type), # noqa: E501 - 'read': ([MessageStatusUser], none_type), # noqa: E501 - 'delivered': ([MessageStatusUser], none_type), # noqa: E501 - 'sent': ([MessageStatusUser], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'author': 'author', # noqa: E501 - 'read': 'read', # noqa: E501 - 'delivered': 'delivered', # noqa: E501 - 'sent': 'sent', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of author + if self.author: + _dict['author'] = self.author.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in read (list) + _items = [] + if self.read: + for _item_read in self.read: + if _item_read: + _items.append(_item_read.to_dict()) + _dict['read'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in delivered (list) + _items = [] + if self.delivered: + for _item_delivered in self.delivered: + if _item_delivered: + _items.append(_item_delivered.to_dict()) + _dict['delivered'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in sent (list) + _items = [] + if self.sent: + for _item_sent in self.sent: + if _item_sent: + _items.append(_item_sent.to_dict()) + _dict['sent'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageStatus - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - author (MessageStatusUser): [optional] # noqa: E501 - read ([MessageStatusUser]): All users who have read that message, in any Symphony client.. [optional] # noqa: E501 - delivered ([MessageStatusUser]): All users who have at least one Symphony client to which the message has been delivered, and not read yet. . [optional] # noqa: E501 - sent ([MessageStatusUser]): All users to whom the message has been sent and received by the Symphony system, but not yet delivered to any user's Symphony client. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageStatus - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - author (MessageStatusUser): [optional] # noqa: E501 - read ([MessageStatusUser]): All users who have read that message, in any Symphony client.. [optional] # noqa: E501 - delivered ([MessageStatusUser]): All users who have at least one Symphony client to which the message has been delivered, and not read yet. . [optional] # noqa: E501 - sent ([MessageStatusUser]): All users to whom the message has been sent and received by the Symphony system, but not yet delivered to any user's Symphony client. . [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageStatus from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "author": MessageStatusUser.from_dict(obj["author"]) if obj.get("author") is not None else None, + "read": [MessageStatusUser.from_dict(_item) for _item in obj["read"]] if obj.get("read") is not None else None, + "delivered": [MessageStatusUser.from_dict(_item) for _item in obj["delivered"]] if obj.get("delivered") is not None else None, + "sent": [MessageStatusUser.from_dict(_item) for _item in obj["sent"]] if obj.get("sent") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.author: MessageStatusUser = None - self.read: List[MessageStatusUser] = None - self.delivered: List[MessageStatusUser] = None - self.sent: List[MessageStatusUser] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/message_status_user.py b/symphony/bdk/gen/pod_model/message_status_user.py index 1e2cac8d..965f2614 100644 --- a/symphony/bdk/gen/pod_model/message_status_user.py +++ b/symphony/bdk/gen/pod_model/message_status_user.py @@ -1,286 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class MessageStatusUser(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_id': (str, none_type), # noqa: E501 - 'first_name': (str, none_type), # noqa: E501 - 'last_name': (str, none_type), # noqa: E501 - 'display_name': (str, none_type), # noqa: E501 - 'email': (str, none_type), # noqa: E501 - 'user_name': (str, none_type), # noqa: E501 - 'timestamp': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user_id': 'userId', # noqa: E501 - 'first_name': 'firstName', # noqa: E501 - 'last_name': 'lastName', # noqa: E501 - 'display_name': 'displayName', # noqa: E501 - 'email': 'email', # noqa: E501 - 'user_name': 'userName', # noqa: E501 - 'timestamp': 'timestamp', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class MessageStatusUser(BaseModel): + """ + MessageStatusUser + """ # noqa: E501 + user_id: Optional[StrictStr] = Field(default=None, alias="userId") + first_name: Optional[StrictStr] = Field(default=None, alias="firstName") + last_name: Optional[StrictStr] = Field(default=None, alias="lastName") + display_name: Optional[StrictStr] = Field(default=None, alias="displayName") + email: Optional[StrictStr] = None + user_name: Optional[StrictStr] = Field(default=None, alias="userName") + timestamp: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["userId", "firstName", "lastName", "displayName", "email", "userName", "timestamp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageStatusUser - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageStatusUser from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - display_name (str): [optional] # noqa: E501 - email (str): [optional] # noqa: E501 - user_name (str): [optional] # noqa: E501 - timestamp (str): [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageStatusUser - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - display_name (str): [optional] # noqa: E501 - email (str): [optional] # noqa: E501 - user_name (str): [optional] # noqa: E501 - timestamp (str): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageStatusUser from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "userId": obj.get("userId"), + "firstName": obj.get("firstName"), + "lastName": obj.get("lastName"), + "displayName": obj.get("displayName"), + "email": obj.get("email"), + "userName": obj.get("userName"), + "timestamp": obj.get("timestamp") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_id: str = None - self.first_name: str = None - self.last_name: str = None - self.display_name: str = None - self.email: str = None - self.user_name: str = None - self.timestamp: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/message_stream.py b/symphony/bdk/gen/pod_model/message_stream.py index f3165e9c..6e28ed18 100644 --- a/symphony/bdk/gen/pod_model/message_stream.py +++ b/symphony/bdk/gen/pod_model/message_stream.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class MessageStream(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'stream_type': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class MessageStream(BaseModel): + """ + MessageStream + """ # noqa: E501 + id: Optional[StrictStr] = None + name: Optional[StrictStr] = None + stream_type: Optional[StrictStr] = Field(default=None, alias="streamType") + __properties: ClassVar[List[str]] = ["id", "name", "streamType"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - 'stream_type': 'streamType', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageStream - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - stream_type (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageStream from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageStream - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - stream_type (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageStream from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "streamType": obj.get("streamType") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.name: str = None - self.stream_type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/message_suppression_response.py b/symphony/bdk/gen/pod_model/message_suppression_response.py index 5d2e3a44..8fc0f020 100644 --- a/symphony/bdk/gen/pod_model/message_suppression_response.py +++ b/symphony/bdk/gen/pod_model/message_suppression_response.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class MessageSuppressionResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message_id': (str, none_type), # noqa: E501 - 'suppressed': (bool, none_type), # noqa: E501 - 'suppression_date': (int, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class MessageSuppressionResponse(BaseModel): + """ + The suppression state of a message + """ # noqa: E501 + message_id: Optional[StrictStr] = Field(default=None, alias="messageId") + suppressed: Optional[StrictBool] = None + suppression_date: Optional[StrictInt] = Field(default=None, description="The date when this message was suppressed.", alias="suppressionDate") + __properties: ClassVar[List[str]] = ["messageId", "suppressed", "suppressionDate"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'message_id': 'messageId', # noqa: E501 - 'suppressed': 'suppressed', # noqa: E501 - 'suppression_date': 'suppressionDate', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageSuppressionResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): [optional] # noqa: E501 - suppressed (bool): [optional] # noqa: E501 - suppression_date (int): The date when this message was suppressed.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageSuppressionResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageSuppressionResponse - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): [optional] # noqa: E501 - suppressed (bool): [optional] # noqa: E501 - suppression_date (int): The date when this message was suppressed.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageSuppressionResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "messageId": obj.get("messageId"), + "suppressed": obj.get("suppressed"), + "suppressionDate": obj.get("suppressionDate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message_id: str = None - self.suppressed: bool = None - self.suppression_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/message_user.py b/symphony/bdk/gen/pod_model/message_user.py index 2b71e5e8..e5c1a75e 100644 --- a/symphony/bdk/gen/pod_model/message_user.py +++ b/symphony/bdk/gen/pod_model/message_user.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class MessageUser(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (int, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class MessageUser(BaseModel): + """ + MessageUser + """ # noqa: E501 + id: Optional[StrictInt] = None + name: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "name"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """MessageUser - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MessageUser from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """MessageUser - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MessageUser from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: int = None - self.name: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/name_value_pair.py b/symphony/bdk/gen/pod_model/name_value_pair.py index f089119f..83d1fc24 100644 --- a/symphony/bdk/gen/pod_model/name_value_pair.py +++ b/symphony/bdk/gen/pod_model/name_value_pair.py @@ -1,261 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class NameValuePair(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str, none_type), # noqa: E501 - 'value': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class NameValuePair(BaseModel): + """ + NameValuePair + """ # noqa: E501 + name: Optional[StrictStr] = None + value: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["name", "value"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'name': 'name', # noqa: E501 - 'value': 'value', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """NameValuePair - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): [optional] # noqa: E501 - value (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of NameValuePair from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """NameValuePair - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): [optional] # noqa: E501 - value (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of NameValuePair from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "value": obj.get("value") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.value: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/pagination.py b/symphony/bdk/gen/pod_model/pagination.py index d0fcb3e0..033c3093 100644 --- a/symphony/bdk/gen/pod_model/pagination.py +++ b/symphony/bdk/gen/pod_model/pagination.py @@ -1,274 +1,95 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.pagination_cursors import PaginationCursors -globals()['PaginationCursors'] = PaginationCursors - -class Pagination(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class Pagination(BaseModel): """ + Pagination + """ # noqa: E501 + cursors: PaginationCursors + previous: Optional[StrictStr] = Field(default=None, description="API endpoint that will return the previous page of data. If not included, this is the first page of data. ") + next: Optional[StrictStr] = Field(default=None, description="API endpoint that will return the next page of data. If not included, this is the last page of data. Due to how pagination works with visibility and privacy, it is possible that a page may be empty but contain a 'next' paging link. Stop paging when the 'next' link no longer appears. ") + __properties: ClassVar[List[str]] = ["cursors", "previous", "next"] - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'cursors': (PaginationCursors,), # noqa: E501 - 'previous': (str, none_type), # noqa: E501 - 'next': (str, none_type), # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'cursors': 'cursors', # noqa: E501 - 'previous': 'previous', # noqa: E501 - 'next': 'next', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, cursors, *args, **kwargs): # noqa: E501 - """Pagination - a pod_model defined in OpenAPI - - Args: - cursors (PaginationCursors): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - previous (str): API endpoint that will return the previous page of data. If not included, this is the first page of data. . [optional] # noqa: E501 - next (str): API endpoint that will return the next page of data. If not included, this is the last page of data. Due to how pagination works with visibility and privacy, it is possible that a page may be empty but contain a 'next' paging link. Stop paging when the 'next' link no longer appears. . [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Pagination from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self = super(OpenApiModel, cls).__new__(cls) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.cursors = cursors - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, cursors, *args, **kwargs): # noqa: E501 - """Pagination - a pod_model defined in OpenAPI - - Args: - cursors (PaginationCursors): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - previous (str): API endpoint that will return the previous page of data. If not included, this is the first page of data. . [optional] # noqa: E501 - next (str): API endpoint that will return the next page of data. If not included, this is the last page of data. Due to how pagination works with visibility and privacy, it is possible that a page may be empty but contain a 'next' paging link. Stop paging when the 'next' link no longer appears. . [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of cursors + if self.cursors: + _dict['cursors'] = self.cursors.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Pagination from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "cursors": PaginationCursors.from_dict(obj["cursors"]) if obj.get("cursors") is not None else None, + "previous": obj.get("previous"), + "next": obj.get("next") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.cursors: PaginationCursors = cursors - self.previous: str = None - self.next: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/pagination_cursors.py b/symphony/bdk/gen/pod_model/pagination_cursors.py index bfeabdf1..cd34be0f 100644 --- a/symphony/bdk/gen/pod_model/pagination_cursors.py +++ b/symphony/bdk/gen/pod_model/pagination_cursors.py @@ -1,266 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class PaginationCursors(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'before': (str,), # noqa: E501 - 'after': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class PaginationCursors(BaseModel): + """ + PaginationCursors + """ # noqa: E501 + before: StrictStr = Field(description="This is the opaque url-safe string that points to the start of the page of data that has been returned. ") + after: Optional[StrictStr] = Field(default=None, description="This is the opaque url-safe string that points to the end of the page of data that has been returned. ") + __properties: ClassVar[List[str]] = ["before", "after"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'before': 'before', # noqa: E501 - 'after': 'after', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, before, *args, **kwargs): # noqa: E501 - """PaginationCursors - a pod_model defined in OpenAPI - - Args: - before (str): This is the opaque url-safe string that points to the start of the page of data that has been returned. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - after (str): This is the opaque url-safe string that points to the end of the page of data that has been returned. . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PaginationCursors from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.before = before - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, before, *args, **kwargs): # noqa: E501 - """PaginationCursors - a pod_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - before (str): This is the opaque url-safe string that points to the start of the page of data that has been returned. + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - after (str): This is the opaque url-safe string that points to the end of the page of data that has been returned. . [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaginationCursors from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "before": obj.get("before"), + "after": obj.get("after") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.before: str = before - self.after: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/password.py b/symphony/bdk/gen/pod_model/password.py index 65559ab4..813dacdc 100644 --- a/symphony/bdk/gen/pod_model/password.py +++ b/symphony/bdk/gen/pod_model/password.py @@ -1,271 +1,93 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class Password(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class Password(BaseModel): """ + Password. Stored as derived password in both the Pod and the Key Manager using PBKDF2 function. Number of iterations should be 10000 and desired length 256 bits. + """ # noqa: E501 + h_salt: Optional[StrictStr] = Field(default=None, description="Pod password salt used for PBKDF2 derivation.", alias="hSalt") + h_password: Optional[StrictStr] = Field(default=None, description="Pod password derived with PBKDF2.", alias="hPassword") + kh_salt: Optional[StrictStr] = Field(default=None, description="Key Manager password salt used for PBKDF2 derivation.", alias="khSalt") + kh_password: Optional[StrictStr] = Field(default=None, description="Key Manager password derived with PBKDF2.", alias="khPassword") + __properties: ClassVar[List[str]] = ["hSalt", "hPassword", "khSalt", "khPassword"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Password from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'h_salt': (str, none_type), # noqa: E501 - 'h_password': (str, none_type), # noqa: E501 - 'kh_salt': (str, none_type), # noqa: E501 - 'kh_password': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'h_salt': 'hSalt', # noqa: E501 - 'h_password': 'hPassword', # noqa: E501 - 'kh_salt': 'khSalt', # noqa: E501 - 'kh_password': 'khPassword', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Password - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - h_salt (str): Pod password salt used for PBKDF2 derivation.. [optional] # noqa: E501 - h_password (str): Pod password derived with PBKDF2.. [optional] # noqa: E501 - kh_salt (str): Key Manager password salt used for PBKDF2 derivation.. [optional] # noqa: E501 - kh_password (str): Key Manager password derived with PBKDF2.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Password - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - h_salt (str): Pod password salt used for PBKDF2 derivation.. [optional] # noqa: E501 - h_password (str): Pod password derived with PBKDF2.. [optional] # noqa: E501 - kh_salt (str): Key Manager password salt used for PBKDF2 derivation.. [optional] # noqa: E501 - kh_password (str): Key Manager password derived with PBKDF2.. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Password from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "hSalt": obj.get("hSalt"), + "hPassword": obj.get("hPassword"), + "khSalt": obj.get("khSalt"), + "khPassword": obj.get("khPassword") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.h_salt: str = None - self.h_password: str = None - self.kh_salt: str = None - self.kh_password: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/password_reset.py b/symphony/bdk/gen/pod_model/password_reset.py index 85e32250..b04637bf 100644 --- a/symphony/bdk/gen/pod_model/password_reset.py +++ b/symphony/bdk/gen/pod_model/password_reset.py @@ -1,259 +1,97 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class PasswordReset(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('type',): { - 'EMAIL': "EMAIL", - }, - } - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - _nullable = False +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +class PasswordReset(BaseModel): + """ + PasswordReset + """ # noqa: E501 + type: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type"] - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str, none_type), # noqa: E501 - } + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - @cached_property - def discriminator(): - return None + if value not in set(['EMAIL']): + raise ValueError("must be one of enum values ('EMAIL')") + return value + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'type': 'type', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """PasswordReset - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] if omitted the server will use the default value of "EMAIL" # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PasswordReset from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """PasswordReset - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] if omitted the server will use the default value of "EMAIL" # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PasswordReset from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = "EMAIL" - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/pod_app_entitlement.py b/symphony/bdk/gen/pod_model/pod_app_entitlement.py index 26d4cfd1..bed80d03 100644 --- a/symphony/bdk/gen/pod_model/pod_app_entitlement.py +++ b/symphony/bdk/gen/pod_model/pod_app_entitlement.py @@ -1,293 +1,96 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class PodAppEntitlement(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class PodAppEntitlement(BaseModel): """ + Application Entitlements for the company + """ # noqa: E501 + app_id: Annotated[str, Field(min_length=1, strict=True, max_length=256)] = Field(description="Unique ID for the Application", alias="appId") + app_name: Annotated[str, Field(min_length=1, strict=True, max_length=50)] = Field(description="Name for this Application", alias="appName") + enable: StrictBool + listed: StrictBool = Field(description="if true, this application will be listed in the appstore for everyone. Otherwise, this application will be hidden in the appstore.") + install: StrictBool = Field(description="if true, the entitlement is set to automatic for the company. Otherwise, it is set to manual.") + __properties: ClassVar[List[str]] = ["appId", "appName", "enable", "listed", "install"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - ('app_id',): { - 'max_length': 256, - 'min_length': 1, - }, - ('app_name',): { - 'max_length': 50, - 'min_length': 1, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PodAppEntitlement from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'app_id': (str,), # noqa: E501 - 'app_name': (str,), # noqa: E501 - 'enable': (bool,), # noqa: E501 - 'listed': (bool,), # noqa: E501 - 'install': (bool,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - + excluded_fields: Set[str] = set([ + ]) - attribute_map = { - 'app_id': 'appId', # noqa: E501 - 'app_name': 'appName', # noqa: E501 - 'enable': 'enable', # noqa: E501 - 'listed': 'listed', # noqa: E501 - 'install': 'install', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, app_id, app_name, enable, listed, install, *args, **kwargs): # noqa: E501 - """PodAppEntitlement - a pod_model defined in OpenAPI - - Args: - app_id (str): Unique ID for the Application - app_name (str): Name for this Application - enable (bool): - listed (bool): if true, this application will be listed in the appstore for everyone. Otherwise, this application will be hidden in the appstore. - install (bool): if true, the entitlement is set to automatic for the company. Otherwise, it is set to manual. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.app_id = app_id - self.app_name = app_name - self.enable = enable - self.listed = listed - self.install = install - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, app_id, app_name, enable, listed, install, *args, **kwargs): # noqa: E501 - """PodAppEntitlement - a pod_model defined in OpenAPI - - Args: - app_id (str): Unique ID for the Application - app_name (str): Name for this Application - enable (bool): - listed (bool): if true, this application will be listed in the appstore for everyone. Otherwise, this application will be hidden in the appstore. - install (bool): if true, the entitlement is set to automatic for the company. Otherwise, it is set to manual. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PodAppEntitlement from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "appId": obj.get("appId"), + "appName": obj.get("appName"), + "enable": obj.get("enable"), + "listed": obj.get("listed"), + "install": obj.get("install") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.app_id: str = app_id - self.app_name: str = app_name - self.enable: bool = enable - self.listed: bool = listed - self.install: bool = install - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/pod_app_entitlement_list.py b/symphony/bdk/gen/pod_model/pod_app_entitlement_list.py deleted file mode 100644 index 9e4b5e53..00000000 --- a/symphony/bdk/gen/pod_model/pod_app_entitlement_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.pod_app_entitlement import PodAppEntitlement -globals()['PodAppEntitlement'] = PodAppEntitlement - -class PodAppEntitlementList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([PodAppEntitlement],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """PodAppEntitlementList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([PodAppEntitlement]): # noqa: E501 - - Keyword Args: - value ([PodAppEntitlement]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[PodAppEntitlement] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """PodAppEntitlementList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([PodAppEntitlement]): # noqa: E501 - - Keyword Args: - value ([PodAppEntitlement]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/pod_certificate.py b/symphony/bdk/gen/pod_model/pod_certificate.py index dada2568..217656f9 100644 --- a/symphony/bdk/gen/pod_model/pod_certificate.py +++ b/symphony/bdk/gen/pod_model/pod_certificate.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class PodCertificate(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'certificate': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class PodCertificate(BaseModel): + """ + PodCertificate + """ # noqa: E501 + certificate: Optional[StrictStr] = Field(default=None, description="Certificate in PEM format") + __properties: ClassVar[List[str]] = ["certificate"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'certificate': 'certificate', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """PodCertificate - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - certificate (str): Certificate in PEM format. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PodCertificate from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """PodCertificate - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - certificate (str): Certificate in PEM format. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PodCertificate from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "certificate": obj.get("certificate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.certificate: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/policy.py b/symphony/bdk/gen/pod_model/policy.py index fa4f2376..eef7a856 100644 --- a/symphony/bdk/gen/pod_model/policy.py +++ b/symphony/bdk/gen/pod_model/policy.py @@ -1,290 +1,109 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Policy(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('policy_type',): { - 'BLOCK': "BLOCK", - 'ALLOW': "ALLOW", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'policy_type': (str, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'member_count': (int, none_type), # noqa: E501 - 'groups': ([str], none_type), # noqa: E501 - 'created_date': (int, none_type), # noqa: E501 - 'modified_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'policy_type': 'policyType', # noqa: E501 - 'active': 'active', # noqa: E501 - 'member_count': 'memberCount', # noqa: E501 - 'groups': 'groups', # noqa: E501 - 'created_date': 'createdDate', # noqa: E501 - 'modified_date': 'modifiedDate', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class Policy(BaseModel): + """ + Information Barrier Policy record. + """ # noqa: E501 + id: Optional[StrictStr] = None + policy_type: Optional[StrictStr] = Field(default=None, alias="policyType") + active: Optional[StrictBool] = None + member_count: Optional[StrictInt] = Field(default=None, alias="memberCount") + groups: Optional[List[StrictStr]] = None + created_date: Optional[StrictInt] = Field(default=None, alias="createdDate") + modified_date: Optional[StrictInt] = Field(default=None, alias="modifiedDate") + __properties: ClassVar[List[str]] = ["id", "policyType", "active", "memberCount", "groups", "createdDate", "modifiedDate"] + + @field_validator('policy_type') + def policy_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['BLOCK', 'ALLOW']): + raise ValueError("must be one of enum values ('BLOCK', 'ALLOW')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Policy - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Policy from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - policy_type (str): [optional] # noqa: E501 - active (bool): [optional] # noqa: E501 - member_count (int): [optional] # noqa: E501 - groups ([str]): [optional] # noqa: E501 - created_date (int): [optional] # noqa: E501 - modified_date (int): [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Policy - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - policy_type (str): [optional] # noqa: E501 - active (bool): [optional] # noqa: E501 - member_count (int): [optional] # noqa: E501 - groups ([str]): [optional] # noqa: E501 - created_date (int): [optional] # noqa: E501 - modified_date (int): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Policy from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "policyType": obj.get("policyType"), + "active": obj.get("active"), + "memberCount": obj.get("memberCount"), + "groups": obj.get("groups"), + "createdDate": obj.get("createdDate"), + "modifiedDate": obj.get("modifiedDate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.policy_type: str = None - self.active: bool = None - self.member_count: int = None - self.groups: List[str] = None - self.created_date: int = None - self.modified_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/policy_list.py b/symphony/bdk/gen/pod_model/policy_list.py deleted file mode 100644 index 5a4594b7..00000000 --- a/symphony/bdk/gen/pod_model/policy_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.policy import Policy -globals()['Policy'] = Policy - -class PolicyList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([Policy],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """PolicyList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Policy]): # noqa: E501 - - Keyword Args: - value ([Policy]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[Policy] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """PolicyList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Policy]): # noqa: E501 - - Keyword Args: - value ([Policy]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/presence.py b/symphony/bdk/gen/pod_model/presence.py deleted file mode 100644 index e5b2f2ce..00000000 --- a/symphony/bdk/gen/pod_model/presence.py +++ /dev/null @@ -1,177 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - - -class Presence(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('category',): { - 'UNDEFINED': "UNDEFINED", - 'AVAILABLE': "AVAILABLE", - 'BUSY': "BUSY", - 'DO_NOT_DISTURB': "DO_NOT_DISTURB", - 'ON_THE_PHONE': "ON_THE_PHONE", - 'BE_RIGHT_BACK': "BE_RIGHT_BACK", - 'AWAY': "AWAY", - 'OFFLINE': "OFFLINE", - }, - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'category': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'category': 'category', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Presence - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - category (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.category: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/product.py b/symphony/bdk/gen/pod_model/product.py index f2531995..e0767663 100644 --- a/symphony/bdk/gen/pod_model/product.py +++ b/symphony/bdk/gen/pod_model/product.py @@ -1,295 +1,96 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class Product(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class Product(BaseModel): """ + Application Product + """ # noqa: E501 + app_id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=256)]] = Field(default=None, description="App ID for the Product", alias="appId") + name: Annotated[str, Field(min_length=1, strict=True, max_length=50)] = Field(description="Product Name") + sku: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=100)]] = Field(default=None, description="Product SKU") + subscribed: StrictBool = Field(description="indicate whether the product is subscribed or not") + type: StrictStr = Field(description="Product Type (default or premium)") + __properties: ClassVar[List[str]] = ["appId", "name", "sku", "subscribed", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - ('name',): { - 'max_length': 50, - 'min_length': 1, - }, - ('app_id',): { - 'max_length': 256, - 'min_length': 1, - }, - ('sku',): { - 'max_length': 100, - 'min_length': 1, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Product from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'name': (str,), # noqa: E501 - 'subscribed': (bool,), # noqa: E501 - 'type': (str,), # noqa: E501 - 'app_id': (str, none_type), # noqa: E501 - 'sku': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - + excluded_fields: Set[str] = set([ + ]) - attribute_map = { - 'name': 'name', # noqa: E501 - 'subscribed': 'subscribed', # noqa: E501 - 'type': 'type', # noqa: E501 - 'app_id': 'appId', # noqa: E501 - 'sku': 'sku', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, name, subscribed, type, *args, **kwargs): # noqa: E501 - """Product - a pod_model defined in OpenAPI - - Args: - name (str): Product Name - subscribed (bool): indicate whether the product is subscribed or not - type (str): Product Type (default or premium) - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_id (str): App ID for the Product. [optional] # noqa: E501 - sku (str): Product SKU. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - self.subscribed = subscribed - self.type = type - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, name, subscribed, type, *args, **kwargs): # noqa: E501 - """Product - a pod_model defined in OpenAPI - - Args: - name (str): Product Name - subscribed (bool): indicate whether the product is subscribed or not - type (str): Product Type (default or premium) - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_id (str): App ID for the Product. [optional] # noqa: E501 - sku (str): Product SKU. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Product from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "appId": obj.get("appId"), + "name": obj.get("name"), + "sku": obj.get("sku"), + "subscribed": obj.get("subscribed"), + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = name - self.subscribed: bool = subscribed - self.type: str = type - self.app_id: str = None - self.sku: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/product_list.py b/symphony/bdk/gen/pod_model/product_list.py deleted file mode 100644 index d2594d07..00000000 --- a/symphony/bdk/gen/pod_model/product_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.product import Product -globals()['Product'] = Product - -class ProductList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([Product],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """ProductList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Product]): # noqa: E501 - - Keyword Args: - value ([Product]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[Product] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """ProductList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Product]): # noqa: E501 - - Keyword Args: - value ([Product]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/protocol.py b/symphony/bdk/gen/pod_model/protocol.py index b19cd40f..6624a757 100644 --- a/symphony/bdk/gen/pod_model/protocol.py +++ b/symphony/bdk/gen/pod_model/protocol.py @@ -1,261 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Protocol(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'scheme': (str,), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Protocol(BaseModel): + """ + Protocol + """ # noqa: E501 + scheme: StrictStr = Field(description="URI protocol scheme (example: http, https, ftp)") + __properties: ClassVar[List[str]] = ["scheme"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'scheme': 'scheme', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, scheme, *args, **kwargs): # noqa: E501 - """Protocol - a pod_model defined in OpenAPI - - Args: - scheme (str): URI protocol scheme (example: http, https, ftp) - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Protocol from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.scheme = scheme - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, scheme, *args, **kwargs): # noqa: E501 - """Protocol - a pod_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - scheme (str): URI protocol scheme (example: http, https, ftp) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Protocol from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "scheme": obj.get("scheme") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.scheme: str = scheme - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/role.py b/symphony/bdk/gen/pod_model/role.py index f3a67201..393204f4 100644 --- a/symphony/bdk/gen/pod_model/role.py +++ b/symphony/bdk/gen/pod_model/role.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Role(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (int, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'description': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Role(BaseModel): + """ + Role record. + """ # noqa: E501 + id: Optional[StrictStr] = None + name: Optional[StrictStr] = None + description: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "name", "description"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - 'description': 'description', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Role - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - description (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Role from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Role - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - description (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Role from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "description": obj.get("description") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: int = None - self.name: str = None - self.description: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/role_detail.py b/symphony/bdk/gen/pod_model/role_detail.py index 54c73480..56f37baa 100644 --- a/symphony/bdk/gen/pod_model/role_detail.py +++ b/symphony/bdk/gen/pod_model/role_detail.py @@ -1,271 +1,93 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class RoleDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class RoleDetail(BaseModel): """ + Role detailed. + """ # noqa: E501 + id: Optional[StrictStr] = None + name: Optional[StrictStr] = None + user_types: Optional[List[StrictStr]] = Field(default=None, alias="userTypes") + optional_actions: Optional[List[StrictStr]] = Field(default=None, alias="optionalActions") + __properties: ClassVar[List[str]] = ["id", "name", "userTypes", "optionalActions"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoleDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (str, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'user_types': ([str], none_type), # noqa: E501 - 'optional_actions': ([str], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - 'user_types': 'userTypes', # noqa: E501 - 'optional_actions': 'optionalActions', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoleDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - user_types ([str]): [optional] # noqa: E501 - optional_actions ([str]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoleDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - name (str): [optional] # noqa: E501 - user_types ([str]): [optional] # noqa: E501 - optional_actions ([str]): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoleDetail from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "userTypes": obj.get("userTypes"), + "optionalActions": obj.get("optionalActions") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.name: str = None - self.user_types: List[str] = None - self.optional_actions: List[str] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/role_detail_list.py b/symphony/bdk/gen/pod_model/role_detail_list.py deleted file mode 100644 index 0e8e66ac..00000000 --- a/symphony/bdk/gen/pod_model/role_detail_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.role_detail import RoleDetail -globals()['RoleDetail'] = RoleDetail - -class RoleDetailList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([RoleDetail],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """RoleDetailList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([RoleDetail]): # noqa: E501 - - Keyword Args: - value ([RoleDetail]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[RoleDetail] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """RoleDetailList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([RoleDetail]): # noqa: E501 - - Keyword Args: - value ([RoleDetail]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/role_list.py b/symphony/bdk/gen/pod_model/role_list.py deleted file mode 100644 index c2d11e17..00000000 --- a/symphony/bdk/gen/pod_model/role_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.role import Role -globals()['Role'] = Role - -class RoleList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([Role],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """RoleList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Role]): # noqa: E501 - - Keyword Args: - value ([Role]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[Role] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """RoleList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([Role]): # noqa: E501 - - Keyword Args: - value ([Role]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/room_attributes.py b/symphony/bdk/gen/pod_model/room_attributes.py index 3c51959c..3ae20cfc 100644 --- a/symphony/bdk/gen/pod_model/room_attributes.py +++ b/symphony/bdk/gen/pod_model/room_attributes.py @@ -1,271 +1,93 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class RoomAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class RoomAttributes(BaseModel): """ + RoomAttributes + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Room name.") + description: Optional[StrictStr] = Field(default=None, description="Room description.") + members_can_invite: Optional[StrictBool] = Field(default=None, description="If true, any chatroom participant can add new participants. If false, only owners can add new participants.", alias="membersCanInvite") + discoverable: Optional[StrictBool] = Field(default=None, description="If true, this chatroom (name, description and messages) can be searched and listed by non-participants. If false, only participants can search this room.") + __properties: ClassVar[List[str]] = ["name", "description", "membersCanInvite", "discoverable"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'name': (str, none_type), # noqa: E501 - 'description': (str, none_type), # noqa: E501 - 'members_can_invite': (bool, none_type), # noqa: E501 - 'discoverable': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'name': 'name', # noqa: E501 - 'description': 'description', # noqa: E501 - 'members_can_invite': 'membersCanInvite', # noqa: E501 - 'discoverable': 'discoverable', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Room name.. [optional] # noqa: E501 - description (str): Room description.. [optional] # noqa: E501 - members_can_invite (bool): If true, any chatroom participant can add new participants. If false, only owners can add new participants.. [optional] # noqa: E501 - discoverable (bool): If true, this chatroom (name, description and messages) can be searched and listed by non-participants. If false, only participants can search this room.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Room name.. [optional] # noqa: E501 - description (str): Room description.. [optional] # noqa: E501 - members_can_invite (bool): If true, any chatroom participant can add new participants. If false, only owners can add new participants.. [optional] # noqa: E501 - discoverable (bool): If true, this chatroom (name, description and messages) can be searched and listed by non-participants. If false, only participants can search this room.. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomAttributes from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "description": obj.get("description"), + "membersCanInvite": obj.get("membersCanInvite"), + "discoverable": obj.get("discoverable") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.description: str = None - self.members_can_invite: bool = None - self.discoverable: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/room_create.py b/symphony/bdk/gen/pod_model/room_create.py deleted file mode 100644 index da01d2d2..00000000 --- a/symphony/bdk/gen/pod_model/room_create.py +++ /dev/null @@ -1,176 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - -from symphony.bdk.gen.pod_model.immutable_room_attributes import ImmutableRoomAttributes -from symphony.bdk.gen.pod_model.room_attributes import RoomAttributes -globals()['ImmutableRoomAttributes'] = ImmutableRoomAttributes -globals()['RoomAttributes'] = RoomAttributes - - -class RoomCreate(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'room_attributes': (RoomAttributes, none_type), # noqa: E501 - 'immutable_room_attributes': (ImmutableRoomAttributes, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'room_attributes': 'roomAttributes', # noqa: E501 - 'immutable_room_attributes': 'immutableRoomAttributes', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomCreate - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - room_attributes (RoomAttributes): [optional] # noqa: E501 - immutable_room_attributes (ImmutableRoomAttributes): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.room_attributes: RoomAttributes = None - self.immutable_room_attributes: ImmutableRoomAttributes = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/room_detail.py b/symphony/bdk/gen/pod_model/room_detail.py index e25cc36d..f55b5040 100644 --- a/symphony/bdk/gen/pod_model/room_detail.py +++ b/symphony/bdk/gen/pod_model/room_detail.py @@ -1,273 +1,103 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.immutable_room_attributes import ImmutableRoomAttributes from symphony.bdk.gen.pod_model.room_attributes import RoomAttributes from symphony.bdk.gen.pod_model.room_system_info import RoomSystemInfo -globals()['ImmutableRoomAttributes'] = ImmutableRoomAttributes -globals()['RoomAttributes'] = RoomAttributes -globals()['RoomSystemInfo'] = RoomSystemInfo +from typing import Optional, Set +from typing_extensions import Self -class RoomDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class RoomDetail(BaseModel): """ + RoomDetail + """ # noqa: E501 + room_attributes: Optional[RoomAttributes] = Field(default=None, alias="roomAttributes") + room_system_info: Optional[RoomSystemInfo] = Field(default=None, alias="roomSystemInfo") + immutable_room_attributes: Optional[ImmutableRoomAttributes] = Field(default=None, alias="immutableRoomAttributes") + __properties: ClassVar[List[str]] = ["roomAttributes", "roomSystemInfo", "immutableRoomAttributes"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'room_attributes': (RoomAttributes, none_type), # noqa: E501 - 'room_system_info': (RoomSystemInfo, none_type), # noqa: E501 - 'immutable_room_attributes': (ImmutableRoomAttributes, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'room_attributes': 'roomAttributes', # noqa: E501 - 'room_system_info': 'roomSystemInfo', # noqa: E501 - 'immutable_room_attributes': 'immutableRoomAttributes', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - room_attributes (RoomAttributes): [optional] # noqa: E501 - room_system_info (RoomSystemInfo): [optional] # noqa: E501 - immutable_room_attributes (ImmutableRoomAttributes): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - room_attributes (RoomAttributes): [optional] # noqa: E501 - room_system_info (RoomSystemInfo): [optional] # noqa: E501 - immutable_room_attributes (ImmutableRoomAttributes): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of room_attributes + if self.room_attributes: + _dict['roomAttributes'] = self.room_attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of room_system_info + if self.room_system_info: + _dict['roomSystemInfo'] = self.room_system_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of immutable_room_attributes + if self.immutable_room_attributes: + _dict['immutableRoomAttributes'] = self.immutable_room_attributes.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomDetail from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "roomAttributes": RoomAttributes.from_dict(obj["roomAttributes"]) if obj.get("roomAttributes") is not None else None, + "roomSystemInfo": RoomSystemInfo.from_dict(obj["roomSystemInfo"]) if obj.get("roomSystemInfo") is not None else None, + "immutableRoomAttributes": ImmutableRoomAttributes.from_dict(obj["immutableRoomAttributes"]) if obj.get("immutableRoomAttributes") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.room_attributes: RoomAttributes = None - self.room_system_info: RoomSystemInfo = None - self.immutable_room_attributes: ImmutableRoomAttributes = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/room_search_criteria.py b/symphony/bdk/gen/pod_model/room_search_criteria.py index fa0fccda..c0206dfb 100644 --- a/symphony/bdk/gen/pod_model/room_search_criteria.py +++ b/symphony/bdk/gen/pod_model/room_search_criteria.py @@ -1,303 +1,123 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.user_id import UserId -globals()['UserId'] = UserId - -class RoomSearchCriteria(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class RoomSearchCriteria(BaseModel): """ - - allowed_values = { - ('sort_order',): { - 'BASIC': "BASIC", - 'RELEVANCE': "RELEVANCE", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'query': (str,), # noqa: E501 - 'labels': ([str], none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'private': (bool, none_type), # noqa: E501 - 'owner': (UserId, none_type), # noqa: E501 - 'creator': (UserId, none_type), # noqa: E501 - 'member': (UserId, none_type), # noqa: E501 - 'sort_order': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'query': 'query', # noqa: E501 - 'labels': 'labels', # noqa: E501 - 'active': 'active', # noqa: E501 - 'private': 'private', # noqa: E501 - 'owner': 'owner', # noqa: E501 - 'creator': 'creator', # noqa: E501 - 'member': 'member', # noqa: E501 - 'sort_order': 'sortOrder', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + Room Query Object. Used to specify the parameters for room search. + """ # noqa: E501 + query: StrictStr = Field(description="The search query. Matches the room name and description.") + labels: Optional[List[StrictStr]] = Field(default=None, description="A list of room tag labels whose values will be queried.") + search_fields: Optional[List[StrictStr]] = Field(default=None, description="The room fields on which to search. Parameter introduced in sbe-25.10.0", alias="searchFields") + active: Optional[StrictBool] = Field(default=None, description="Restrict the search to active/inactive rooms. If unspecified, search all rooms.") + private: Optional[StrictBool] = Field(default=None, description="Restrict the search to private rooms. If unspecified, search all rooms.") + owner: Optional[UserId] = None + creator: Optional[UserId] = None + member: Optional[UserId] = None + sort_order: Optional[StrictStr] = Field(default=None, description="Sort algorithm to be used. Supports two values: \"BASIC\" (legacy algorithm) and \"RELEVANCE\" (enhanced algorithm). ", alias="sortOrder") + __properties: ClassVar[List[str]] = ["query", "labels", "searchFields", "active", "private", "owner", "creator", "member", "sortOrder"] + + @field_validator('sort_order') + def sort_order_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['BASIC', 'RELEVANCE']): + raise ValueError("must be one of enum values ('BASIC', 'RELEVANCE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, query, *args, **kwargs): # noqa: E501 - """RoomSearchCriteria - a pod_model defined in OpenAPI - - Args: - query (str): The search query. Matches the room name and description. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - labels ([str]): A list of room tag labels whose values will be queried.. [optional] # noqa: E501 - active (bool): Restrict the search to active/inactive rooms. If unspecified, search all rooms.. [optional] # noqa: E501 - private (bool): Restrict the search to private rooms. If unspecified, search all rooms.. [optional] # noqa: E501 - owner (UserId): [optional] # noqa: E501 - creator (UserId): [optional] # noqa: E501 - member (UserId): [optional] # noqa: E501 - sort_order (str): Sort algorithm to be used. Supports two values: \"BASIC\" (legacy algorithm) and \"RELEVANCE\" (enhanced algorithm). . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomSearchCriteria from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.query = query - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, query, *args, **kwargs): # noqa: E501 - """RoomSearchCriteria - a pod_model defined in OpenAPI - - Args: - query (str): The search query. Matches the room name and description. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - labels ([str]): A list of room tag labels whose values will be queried.. [optional] # noqa: E501 - active (bool): Restrict the search to active/inactive rooms. If unspecified, search all rooms.. [optional] # noqa: E501 - private (bool): Restrict the search to private rooms. If unspecified, search all rooms.. [optional] # noqa: E501 - owner (UserId): [optional] # noqa: E501 - creator (UserId): [optional] # noqa: E501 - member (UserId): [optional] # noqa: E501 - sort_order (str): Sort algorithm to be used. Supports two values: \"BASIC\" (legacy algorithm) and \"RELEVANCE\" (enhanced algorithm). . [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of owner + if self.owner: + _dict['owner'] = self.owner.to_dict() + # override the default output from pydantic by calling `to_dict()` of creator + if self.creator: + _dict['creator'] = self.creator.to_dict() + # override the default output from pydantic by calling `to_dict()` of member + if self.member: + _dict['member'] = self.member.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomSearchCriteria from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "query": obj.get("query"), + "labels": obj.get("labels"), + "searchFields": obj.get("searchFields"), + "active": obj.get("active"), + "private": obj.get("private"), + "owner": UserId.from_dict(obj["owner"]) if obj.get("owner") is not None else None, + "creator": UserId.from_dict(obj["creator"]) if obj.get("creator") is not None else None, + "member": UserId.from_dict(obj["member"]) if obj.get("member") is not None else None, + "sortOrder": obj.get("sortOrder") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.query: str = query - self.labels: List[str] = None - self.active: bool = None - self.private: bool = None - self.owner: UserId = None - self.creator: UserId = None - self.member: UserId = None - self.sort_order: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/room_search_results.py b/symphony/bdk/gen/pod_model/room_search_results.py deleted file mode 100644 index 537f1f61..00000000 --- a/symphony/bdk/gen/pod_model/room_search_results.py +++ /dev/null @@ -1,194 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - -from symphony.bdk.gen.pod_model.faceted_match_count import FacetedMatchCount -from symphony.bdk.gen.pod_model.room_search_criteria import RoomSearchCriteria -from symphony.bdk.gen.pod_model.v2_room_detail import V2RoomDetail -globals()['FacetedMatchCount'] = FacetedMatchCount -globals()['RoomSearchCriteria'] = RoomSearchCriteria -globals()['V2RoomDetail'] = V2RoomDetail - - -class RoomSearchResults(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'count': (int, none_type), # noqa: E501 - 'skip': (int, none_type), # noqa: E501 - 'limit': (int, none_type), # noqa: E501 - 'query': (RoomSearchCriteria, none_type), # noqa: E501 - 'rooms': ([V2RoomDetail], none_type), # noqa: E501 - 'faceted_match_count': ([FacetedMatchCount], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'count': 'count', # noqa: E501 - 'skip': 'skip', # noqa: E501 - 'limit': 'limit', # noqa: E501 - 'query': 'query', # noqa: E501 - 'rooms': 'rooms', # noqa: E501 - 'faceted_match_count': 'facetedMatchCount', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomSearchResults - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): The total number of rooms matched by the search.. [optional] # noqa: E501 - skip (int): The number of skipped results.. [optional] # noqa: E501 - limit (int): The number of returned results.. [optional] # noqa: E501 - query (RoomSearchCriteria): [optional] # noqa: E501 - rooms ([V2RoomDetail]): A list of rooms matched by the query.. [optional] # noqa: E501 - faceted_match_count ([FacetedMatchCount]): Detailed counts of matched rooms per search criterion.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.count: int = None - self.skip: int = None - self.limit: int = None - self.query: RoomSearchCriteria = None - self.rooms: List[V2RoomDetail] = None - self.faceted_match_count: List[FacetedMatchCount] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/room_specific_stream_attributes.py b/symphony/bdk/gen/pod_model/room_specific_stream_attributes.py index 0b7c5adb..02e7e4be 100644 --- a/symphony/bdk/gen/pod_model/room_specific_stream_attributes.py +++ b/symphony/bdk/gen/pod_model/room_specific_stream_attributes.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class RoomSpecificStreamAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class RoomSpecificStreamAttributes(BaseModel): + """ + RoomSpecificStreamAttributes + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Room name.") + __properties: ClassVar[List[str]] = ["name"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'name': 'name', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomSpecificStreamAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Room name.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomSpecificStreamAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomSpecificStreamAttributes - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Room name.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomSpecificStreamAttributes from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/room_system_info.py b/symphony/bdk/gen/pod_model/room_system_info.py index 7038ae2a..69c125be 100644 --- a/symphony/bdk/gen/pod_model/room_system_info.py +++ b/symphony/bdk/gen/pod_model/room_system_info.py @@ -1,271 +1,93 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class RoomSystemInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class RoomSystemInfo(BaseModel): """ + RoomSystemInfo + """ # noqa: E501 + id: Optional[StrictStr] = None + creation_date: Optional[StrictInt] = Field(default=None, description="The datetime when the stream was originally created. Milliseconds since Jan 1 1970.", alias="creationDate") + created_by_user_id: Optional[StrictInt] = Field(default=None, alias="createdByUserId") + active: Optional[StrictBool] = Field(default=None, description="If false, no messages can be sent in this stream, and membership is locked.") + __properties: ClassVar[List[str]] = ["id", "creationDate", "createdByUserId", "active"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomSystemInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (str, none_type), # noqa: E501 - 'creation_date': (int, none_type), # noqa: E501 - 'created_by_user_id': (int, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'id': 'id', # noqa: E501 - 'creation_date': 'creationDate', # noqa: E501 - 'created_by_user_id': 'createdByUserId', # noqa: E501 - 'active': 'active', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """RoomSystemInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - creation_date (int): The datetime when the stream was originally created. Milliseconds since Jan 1 1970.. [optional] # noqa: E501 - created_by_user_id (int): [optional] # noqa: E501 - active (bool): If false, no messages can be sent in this stream, and membership is locked.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """RoomSystemInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - creation_date (int): The datetime when the stream was originally created. Milliseconds since Jan 1 1970.. [optional] # noqa: E501 - created_by_user_id (int): [optional] # noqa: E501 - active (bool): If false, no messages can be sent in this stream, and membership is locked.. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomSystemInfo from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "creationDate": obj.get("creationDate"), + "createdByUserId": obj.get("createdByUserId"), + "active": obj.get("active") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.creation_date: int = None - self.created_by_user_id: int = None - self.active: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/room_tag.py b/symphony/bdk/gen/pod_model/room_tag.py index 9f862129..2f1df1a4 100644 --- a/symphony/bdk/gen/pod_model/room_tag.py +++ b/symphony/bdk/gen/pod_model/room_tag.py @@ -1,267 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class RoomTag(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'key': (str,), # noqa: E501 - 'value': (str,), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class RoomTag(BaseModel): + """ + Room Tag object. A key:value pair describing additional properties of the room. + """ # noqa: E501 + key: StrictStr = Field(description="A unique label of the Tag.") + value: StrictStr = Field(description="The value of this Tag's label.") + __properties: ClassVar[List[str]] = ["key", "value"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'key': 'key', # noqa: E501 - 'value': 'value', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, key, value, *args, **kwargs): # noqa: E501 - """RoomTag - a pod_model defined in OpenAPI - - Args: - key (str): A unique label of the Tag. - value (str): The value of this Tag's label. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RoomTag from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.key = key - self.value = value - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, key, value, *args, **kwargs): # noqa: E501 - """RoomTag - a pod_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - key (str): A unique label of the Tag. - value (str): The value of this Tag's label. + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RoomTag from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "key": obj.get("key"), + "value": obj.get("value") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.key: str = key - self.value: str = value - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/service_account_manifest.py b/symphony/bdk/gen/pod_model/service_account_manifest.py index 704d5c55..d12ca0dd 100644 --- a/symphony/bdk/gen/pod_model/service_account_manifest.py +++ b/symphony/bdk/gen/pod_model/service_account_manifest.py @@ -1,264 +1,88 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class ServiceAccountManifest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - ('manifest',): { - 'max_length': 6144, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'manifest': (str,), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class ServiceAccountManifest(BaseModel): + """ + ServiceAccountManifest + """ # noqa: E501 + manifest: Annotated[str, Field(strict=True, max_length=6144)] = Field(description="Manifest containing commands supported by the service account. Must be valid JSON.") + __properties: ClassVar[List[str]] = ["manifest"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'manifest': 'manifest', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, manifest, *args, **kwargs): # noqa: E501 - """ServiceAccountManifest - a pod_model defined in OpenAPI - - Args: - manifest (str): Manifest containing commands supported by the service account. Must be valid JSON. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ServiceAccountManifest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.manifest = manifest - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, manifest, *args, **kwargs): # noqa: E501 - """ServiceAccountManifest - a pod_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - manifest (str): Manifest containing commands supported by the service account. Must be valid JSON. + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ServiceAccountManifest from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "manifest": obj.get("manifest") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.manifest: str = manifest - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/session_info.py b/symphony/bdk/gen/pod_model/session_info.py deleted file mode 100644 index 56aeb200..00000000 --- a/symphony/bdk/gen/pod_model/session_info.py +++ /dev/null @@ -1,167 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - - -class SessionInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_id': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user_id': 'userId', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """SessionInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_id: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/stream.py b/symphony/bdk/gen/pod_model/stream.py index 117d4e45..aa0d6837 100644 --- a/symphony/bdk/gen/pod_model/stream.py +++ b/symphony/bdk/gen/pod_model/stream.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class Stream(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class Stream(BaseModel): + """ + Stream + """ # noqa: E501 + id: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """Stream - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Stream from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """Stream - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Stream from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/stream_attachment_item.py b/symphony/bdk/gen/pod_model/stream_attachment_item.py index 580593d5..6cd6f58d 100644 --- a/symphony/bdk/gen/pod_model/stream_attachment_item.py +++ b/symphony/bdk/gen/pod_model/stream_attachment_item.py @@ -1,294 +1,109 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.attachment_preview import AttachmentPreview -globals()['AttachmentPreview'] = AttachmentPreview - -class StreamAttachmentItem(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class StreamAttachmentItem(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'message_id': (str, none_type), # noqa: E501 - 'ingestion_date': (int, none_type), # noqa: E501 - 'user_id': (int, none_type), # noqa: E501 - 'file_id': (str, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'size': (int, none_type), # noqa: E501 - 'content_type': (str, none_type), # noqa: E501 - 'previews': ([AttachmentPreview], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'message_id': 'messageId', # noqa: E501 - 'ingestion_date': 'ingestionDate', # noqa: E501 - 'user_id': 'userId', # noqa: E501 - 'file_id': 'fileId', # noqa: E501 - 'name': 'name', # noqa: E501 - 'size': 'size', # noqa: E501 - 'content_type': 'content-type', # noqa: E501 - 'previews': 'previews', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + File attachments for a message in a stream + """ # noqa: E501 + message_id: Optional[StrictStr] = Field(default=None, alias="messageId") + ingestion_date: Optional[StrictInt] = Field(default=None, alias="ingestionDate") + user_id: Optional[StrictInt] = Field(default=None, alias="userId") + file_id: Optional[StrictStr] = Field(default=None, description="The attachment File ID.", alias="fileId") + name: Optional[StrictStr] = Field(default=None, description="The file name.") + size: Optional[StrictInt] = Field(default=None, description="Size in bytes.") + content_type: Optional[StrictStr] = Field(default=None, alias="content-type") + previews: Optional[List[AttachmentPreview]] = None + __properties: ClassVar[List[str]] = ["messageId", "ingestionDate", "userId", "fileId", "name", "size", "content-type", "previews"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """StreamAttachmentItem - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): [optional] # noqa: E501 - ingestion_date (int): [optional] # noqa: E501 - user_id (int): [optional] # noqa: E501 - file_id (str): The attachment File ID.. [optional] # noqa: E501 - name (str): The file name.. [optional] # noqa: E501 - size (int): Size in bytes.. [optional] # noqa: E501 - content_type (str): [optional] # noqa: E501 - previews ([AttachmentPreview]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StreamAttachmentItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """StreamAttachmentItem - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - message_id (str): [optional] # noqa: E501 - ingestion_date (int): [optional] # noqa: E501 - user_id (int): [optional] # noqa: E501 - file_id (str): The attachment File ID.. [optional] # noqa: E501 - name (str): The file name.. [optional] # noqa: E501 - size (int): Size in bytes.. [optional] # noqa: E501 - content_type (str): [optional] # noqa: E501 - previews ([AttachmentPreview]): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in previews (list) + _items = [] + if self.previews: + for _item_previews in self.previews: + if _item_previews: + _items.append(_item_previews.to_dict()) + _dict['previews'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StreamAttachmentItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "messageId": obj.get("messageId"), + "ingestionDate": obj.get("ingestionDate"), + "userId": obj.get("userId"), + "fileId": obj.get("fileId"), + "name": obj.get("name"), + "size": obj.get("size"), + "content-type": obj.get("content-type"), + "previews": [AttachmentPreview.from_dict(_item) for _item in obj["previews"]] if obj.get("previews") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.message_id: str = None - self.ingestion_date: int = None - self.user_id: int = None - self.file_id: str = None - self.name: str = None - self.size: int = None - self.content_type: str = None - self.previews: List[AttachmentPreview] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/stream_attachment_response.py b/symphony/bdk/gen/pod_model/stream_attachment_response.py deleted file mode 100644 index b3e3c868..00000000 --- a/symphony/bdk/gen/pod_model/stream_attachment_response.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.stream_attachment_item import StreamAttachmentItem -globals()['StreamAttachmentItem'] = StreamAttachmentItem - -class StreamAttachmentResponse(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([StreamAttachmentItem],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """StreamAttachmentResponse - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([StreamAttachmentItem]): # noqa: E501 - - Keyword Args: - value ([StreamAttachmentItem]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[StreamAttachmentItem] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """StreamAttachmentResponse - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([StreamAttachmentItem]): # noqa: E501 - - Keyword Args: - value ([StreamAttachmentItem]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/stream_attributes.py b/symphony/bdk/gen/pod_model/stream_attributes.py index 92e3dfb0..7fb0515c 100644 --- a/symphony/bdk/gen/pod_model/stream_attributes.py +++ b/symphony/bdk/gen/pod_model/stream_attributes.py @@ -1,288 +1,109 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.conversation_specific_stream_attributes import ConversationSpecificStreamAttributes from symphony.bdk.gen.pod_model.room_specific_stream_attributes import RoomSpecificStreamAttributes from symphony.bdk.gen.pod_model.stream_type import StreamType -globals()['ConversationSpecificStreamAttributes'] = ConversationSpecificStreamAttributes -globals()['RoomSpecificStreamAttributes'] = RoomSpecificStreamAttributes -globals()['StreamType'] = StreamType - -class StreamAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class StreamAttributes(BaseModel): """ + StreamAttributes + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The stream ID.") + cross_pod: Optional[StrictBool] = Field(default=None, description="If true, this is a cross-pod stream.", alias="crossPod") + active: Optional[StrictBool] = Field(default=None, description="If true, this stream is active.") + stream_type: Optional[StreamType] = Field(default=None, alias="streamType") + stream_attributes: Optional[ConversationSpecificStreamAttributes] = Field(default=None, alias="streamAttributes") + room_attributes: Optional[RoomSpecificStreamAttributes] = Field(default=None, alias="roomAttributes") + __properties: ClassVar[List[str]] = ["id", "crossPod", "active", "streamType", "streamAttributes", "roomAttributes"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StreamAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (str, none_type), # noqa: E501 - 'cross_pod': (bool, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'stream_type': (StreamType, none_type), # noqa: E501 - 'stream_attributes': (ConversationSpecificStreamAttributes, none_type), # noqa: E501 - 'room_attributes': (RoomSpecificStreamAttributes, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'cross_pod': 'crossPod', # noqa: E501 - 'active': 'active', # noqa: E501 - 'stream_type': 'streamType', # noqa: E501 - 'stream_attributes': 'streamAttributes', # noqa: E501 - 'room_attributes': 'roomAttributes', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream_type + if self.stream_type: + _dict['streamType'] = self.stream_type.to_dict() + # override the default output from pydantic by calling `to_dict()` of stream_attributes + if self.stream_attributes: + _dict['streamAttributes'] = self.stream_attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of room_attributes + if self.room_attributes: + _dict['roomAttributes'] = self.room_attributes.to_dict() + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """StreamAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The stream ID.. [optional] # noqa: E501 - cross_pod (bool): If true, this is a cross-pod stream.. [optional] # noqa: E501 - active (bool): If true, this stream is active.. [optional] # noqa: E501 - stream_type (StreamType): [optional] # noqa: E501 - stream_attributes (ConversationSpecificStreamAttributes): [optional] # noqa: E501 - room_attributes (RoomSpecificStreamAttributes): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """StreamAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The stream ID.. [optional] # noqa: E501 - cross_pod (bool): If true, this is a cross-pod stream.. [optional] # noqa: E501 - active (bool): If true, this stream is active.. [optional] # noqa: E501 - stream_type (StreamType): [optional] # noqa: E501 - stream_attributes (ConversationSpecificStreamAttributes): [optional] # noqa: E501 - room_attributes (RoomSpecificStreamAttributes): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StreamAttributes from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "crossPod": obj.get("crossPod"), + "active": obj.get("active"), + "streamType": StreamType.from_dict(obj["streamType"]) if obj.get("streamType") is not None else None, + "streamAttributes": ConversationSpecificStreamAttributes.from_dict(obj["streamAttributes"]) if obj.get("streamAttributes") is not None else None, + "roomAttributes": RoomSpecificStreamAttributes.from_dict(obj["roomAttributes"]) if obj.get("roomAttributes") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.cross_pod: bool = None - self.active: bool = None - self.stream_type: StreamType = None - self.stream_attributes: ConversationSpecificStreamAttributes = None - self.room_attributes: RoomSpecificStreamAttributes = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/stream_filter.py b/symphony/bdk/gen/pod_model/stream_filter.py index cc35f9aa..4b3423bc 100644 --- a/symphony/bdk/gen/pod_model/stream_filter.py +++ b/symphony/bdk/gen/pod_model/stream_filter.py @@ -1,264 +1,97 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.stream_type import StreamType -globals()['StreamType'] = StreamType +from typing import Optional, Set +from typing_extensions import Self -class StreamFilter(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class StreamFilter(BaseModel): """ + Stream filtering parameters. + """ # noqa: E501 + stream_types: Optional[List[StreamType]] = Field(default=None, description="Types of streams to search for.", alias="streamTypes") + include_inactive_streams: Optional[StrictBool] = Field(default=None, description="Whether to include inactive streams in the list of results.", alias="includeInactiveStreams") + __properties: ClassVar[List[str]] = ["streamTypes", "includeInactiveStreams"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream_types': ([StreamType], none_type), # noqa: E501 - 'include_inactive_streams': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream_types': 'streamTypes', # noqa: E501 - 'include_inactive_streams': 'includeInactiveStreams', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """StreamFilter - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream_types ([StreamType]): Types of streams to search for.. [optional] # noqa: E501 - include_inactive_streams (bool): Whether to include inactive streams in the list of results.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StreamFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """StreamFilter - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream_types ([StreamType]): Types of streams to search for.. [optional] # noqa: E501 - include_inactive_streams (bool): Whether to include inactive streams in the list of results.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in stream_types (list) + _items = [] + if self.stream_types: + for _item_stream_types in self.stream_types: + if _item_stream_types: + _items.append(_item_stream_types.to_dict()) + _dict['streamTypes'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StreamFilter from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "streamTypes": [StreamType.from_dict(_item) for _item in obj["streamTypes"]] if obj.get("streamTypes") is not None else None, + "includeInactiveStreams": obj.get("includeInactiveStreams") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream_types: List[StreamType] = None - self.include_inactive_streams: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/stream_list.py b/symphony/bdk/gen/pod_model/stream_list.py deleted file mode 100644 index 45a3c63a..00000000 --- a/symphony/bdk/gen/pod_model/stream_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.stream_attributes import StreamAttributes -globals()['StreamAttributes'] = StreamAttributes - -class StreamList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([StreamAttributes],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """StreamList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([StreamAttributes]): A list of streams of which the requesting user is a member.. # noqa: E501 - - Keyword Args: - value ([StreamAttributes]): A list of streams of which the requesting user is a member.. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[StreamAttributes] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """StreamList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([StreamAttributes]): A list of streams of which the requesting user is a member.. # noqa: E501 - - Keyword Args: - value ([StreamAttributes]): A list of streams of which the requesting user is a member.. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/stream_type.py b/symphony/bdk/gen/pod_model/stream_type.py index 792b6cdb..a780836f 100644 --- a/symphony/bdk/gen/pod_model/stream_type.py +++ b/symphony/bdk/gen/pod_model/stream_type.py @@ -1,262 +1,97 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class StreamType(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('type',): { - 'IM': "IM", - 'MIM': "MIM", - 'ROOM': "ROOM", - 'POST': "POST", - }, - } - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - _nullable = False +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +class StreamType(BaseModel): + """ + StreamType + """ # noqa: E501 + type: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type"] - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str, none_type), # noqa: E501 - } + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - @cached_property - def discriminator(): - return None + if value not in set(['IM', 'MIM', 'ROOM', 'POST']): + raise ValueError("must be one of enum values ('IM', 'MIM', 'ROOM', 'POST')") + return value + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'type': 'type', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """StreamType - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StreamType from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """StreamType - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StreamType from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/string_id.py b/symphony/bdk/gen/pod_model/string_id.py index 4566547a..6af20267 100644 --- a/symphony/bdk/gen/pod_model/string_id.py +++ b/symphony/bdk/gen/pod_model/string_id.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class StringId(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class StringId(BaseModel): + """ + StringId + """ # noqa: E501 + id: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """StringId - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StringId from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """StringId - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StringId from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/string_list.py b/symphony/bdk/gen/pod_model/string_list.py deleted file mode 100644 index 602665d6..00000000 --- a/symphony/bdk/gen/pod_model/string_list.py +++ /dev/null @@ -1,278 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class StringList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([str],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """StringList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([str]): # noqa: E501 - - Keyword Args: - value ([str]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[str] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """StringList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([str]): # noqa: E501 - - Keyword Args: - value ([str]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/success_response.py b/symphony/bdk/gen/pod_model/success_response.py index 3b6738b0..39022275 100644 --- a/symphony/bdk/gen/pod_model/success_response.py +++ b/symphony/bdk/gen/pod_model/success_response.py @@ -1,265 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class SuccessResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class SuccessResponse(BaseModel): """ + SuccessResponse + """ # noqa: E501 + format: Optional[StrictStr] = None + message: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["format", "message"] + + @field_validator('format') + def format_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['TEXT', 'XML']): + raise ValueError("must be one of enum values ('TEXT', 'XML')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('format',): { - 'TEXT': "TEXT", - 'XML': "XML", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SuccessResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'format': (str, none_type), # noqa: E501 - 'message': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'format': 'format', # noqa: E501 - 'message': 'message', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """SuccessResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """SuccessResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - format (str): [optional] # noqa: E501 - message (str): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SuccessResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "format": obj.get("format"), + "message": obj.get("message") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.format: str = None - self.message: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user.py b/symphony/bdk/gen/pod_model/user.py deleted file mode 100644 index db2d5303..00000000 --- a/symphony/bdk/gen/pod_model/user.py +++ /dev/null @@ -1,171 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - - -class User(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (int, none_type), # noqa: E501 - 'email_address': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'email_address': 'emailAddress', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """User - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - email_address (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: int = None - self.email_address: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/user_app_entitlement.py b/symphony/bdk/gen/pod_model/user_app_entitlement.py index b611bd86..29fde921 100644 --- a/symphony/bdk/gen/pod_model/user_app_entitlement.py +++ b/symphony/bdk/gen/pod_model/user_app_entitlement.py @@ -1,294 +1,104 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.pod_model.product_list import ProductList -globals()['ProductList'] = ProductList -class UserAppEntitlement(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from symphony.bdk.gen.pod_model.product import Product +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserAppEntitlement(BaseModel): """ + Application Entitlements for the user + """ # noqa: E501 + app_id: Annotated[str, Field(min_length=1, strict=True, max_length=256)] = Field(description="Unique ID for the Application", alias="appId") + app_name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=50)]] = Field(default=None, description="Name for this Application", alias="appName") + listed: StrictBool = Field(description="if true, this application will be listed in the appstore for this user. Otherwise, this application will be hidden in the appstore.") + install: StrictBool = Field(description="if true, it indicate this application is installed for this user. Otherwise, this user does not have this application installed.") + products: Optional[List[Product]] = None + __properties: ClassVar[List[str]] = ["appId", "appName", "listed", "install", "products"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - ('app_id',): { - 'max_length': 256, - 'min_length': 1, - }, - ('app_name',): { - 'max_length': 50, - 'min_length': 1, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserAppEntitlement from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'app_id': (str,), # noqa: E501 - 'listed': (bool,), # noqa: E501 - 'install': (bool,), # noqa: E501 - 'app_name': (str, none_type), # noqa: E501 - 'products': (ProductList, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'app_id': 'appId', # noqa: E501 - 'listed': 'listed', # noqa: E501 - 'install': 'install', # noqa: E501 - 'app_name': 'appName', # noqa: E501 - 'products': 'products', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in products (list) + _items = [] + if self.products: + for _item_products in self.products: + if _item_products: + _items.append(_item_products.to_dict()) + _dict['products'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, app_id, listed, install, *args, **kwargs): # noqa: E501 - """UserAppEntitlement - a pod_model defined in OpenAPI - - Args: - app_id (str): Unique ID for the Application - listed (bool): if true, this application will be listed in the appstore for this user. Otherwise, this application will be hidden in the appstore. - install (bool): if true, it indicate this application is installed for this user. Otherwise, this user does not have this application installed. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_name (str): Name for this Application. [optional] # noqa: E501 - products (ProductList): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.app_id = app_id - self.listed = listed - self.install = install - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, app_id, listed, install, *args, **kwargs): # noqa: E501 - """UserAppEntitlement - a pod_model defined in OpenAPI - - Args: - app_id (str): Unique ID for the Application - listed (bool): if true, this application will be listed in the appstore for this user. Otherwise, this application will be hidden in the appstore. - install (bool): if true, it indicate this application is installed for this user. Otherwise, this user does not have this application installed. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - app_name (str): Name for this Application. [optional] # noqa: E501 - products (ProductList): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserAppEntitlement from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "appId": obj.get("appId"), + "appName": obj.get("appName"), + "listed": obj.get("listed"), + "install": obj.get("install"), + "products": [Product.from_dict(_item) for _item in obj["products"]] if obj.get("products") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.app_id: str = app_id - self.listed: bool = listed - self.install: bool = install - self.app_name: str = None - self.products: ProductList = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_app_entitlement_list.py b/symphony/bdk/gen/pod_model/user_app_entitlement_list.py deleted file mode 100644 index 9d55bcd8..00000000 --- a/symphony/bdk/gen/pod_model/user_app_entitlement_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.user_app_entitlement import UserAppEntitlement -globals()['UserAppEntitlement'] = UserAppEntitlement - -class UserAppEntitlementList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([UserAppEntitlement],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """UserAppEntitlementList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([UserAppEntitlement]): # noqa: E501 - - Keyword Args: - value ([UserAppEntitlement]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[UserAppEntitlement] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """UserAppEntitlementList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([UserAppEntitlement]): # noqa: E501 - - Keyword Args: - value ([UserAppEntitlement]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/user_app_entitlement_patch.py b/symphony/bdk/gen/pod_model/user_app_entitlement_patch.py index e7e6ff61..fdf6c903 100644 --- a/symphony/bdk/gen/pod_model/user_app_entitlement_patch.py +++ b/symphony/bdk/gen/pod_model/user_app_entitlement_patch.py @@ -1,295 +1,118 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from symphony.bdk.gen.pod_model.product import Product -globals()['Product'] = Product - -class UserAppEntitlementPatch(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserAppEntitlementPatch(BaseModel): """ + Application Entitlements to patch for the user + """ # noqa: E501 + app_id: Annotated[str, Field(min_length=1, strict=True, max_length=256)] = Field(description="Unique ID for the Application", alias="appId") + listed: Optional[StrictStr] = Field(default='KEEP', description="If \"TRUE\", this application will be listed in the appstore for this user. If \"FALSE\", this application will be hidden in the appstore. If \"KEEP\" or not set, the current value is kept. If \"REMOVE\", it will be removed from user settings and the pod level setting's value will be used.") + install: Optional[StrictStr] = Field(default='KEEP', description="If \"TRUE\", this application will be installed for this user. If \"FALSE\", this application will not be installed for this user. If \"KEEP\" or not set, the current value is kept. If \"REMOVE\", it will be removed from user settings and the pod level setting's value will be used.") + product: Optional[Product] = None + __properties: ClassVar[List[str]] = ["appId", "listed", "install", "product"] + + @field_validator('listed') + def listed_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['TRUE', 'FALSE', 'KEEP', 'REMOVE']): + raise ValueError("must be one of enum values ('TRUE', 'FALSE', 'KEEP', 'REMOVE')") + return value + + @field_validator('install') + def install_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['TRUE', 'FALSE', 'KEEP', 'REMOVE']): + raise ValueError("must be one of enum values ('TRUE', 'FALSE', 'KEEP', 'REMOVE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('listed',): { - 'TRUE': "TRUE", - 'FALSE': "FALSE", - 'KEEP': "KEEP", - 'REMOVE': "REMOVE", - }, - ('install',): { - 'TRUE': "TRUE", - 'FALSE': "FALSE", - 'KEEP': "KEEP", - 'REMOVE': "REMOVE", - }, - } - - validations = { - ('app_id',): { - 'max_length': 256, - 'min_length': 1, - }, - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserAppEntitlementPatch from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'app_id': (str,), # noqa: E501 - 'listed': (str, none_type), # noqa: E501 - 'install': (str, none_type), # noqa: E501 - 'product': (Product, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'app_id': 'appId', # noqa: E501 - 'listed': 'listed', # noqa: E501 - 'install': 'install', # noqa: E501 - 'product': 'product', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of product + if self.product: + _dict['product'] = self.product.to_dict() + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, app_id, *args, **kwargs): # noqa: E501 - """UserAppEntitlementPatch - a pod_model defined in OpenAPI - - Args: - app_id (str): Unique ID for the Application - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - listed (str): If \"TRUE\", this application will be listed in the appstore for this user. If \"FALSE\", this application will be hidden in the appstore. If \"KEEP\" or not set, the current value is kept. If \"REMOVE\", it will be removed from user settings and the pod level setting's value will be used.. [optional] if omitted the server will use the default value of "KEEP" # noqa: E501 - install (str): If \"TRUE\", this application will be installed for this user. If \"FALSE\", this application will not be installed for this user. If \"KEEP\" or not set, the current value is kept. If \"REMOVE\", it will be removed from user settings and the pod level setting's value will be used.. [optional] if omitted the server will use the default value of "KEEP" # noqa: E501 - product (Product): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.app_id = app_id - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, app_id, *args, **kwargs): # noqa: E501 - """UserAppEntitlementPatch - a pod_model defined in OpenAPI - - Args: - app_id (str): Unique ID for the Application - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - listed (str): If \"TRUE\", this application will be listed in the appstore for this user. If \"FALSE\", this application will be hidden in the appstore. If \"KEEP\" or not set, the current value is kept. If \"REMOVE\", it will be removed from user settings and the pod level setting's value will be used.. [optional] if omitted the server will use the default value of "KEEP" # noqa: E501 - install (str): If \"TRUE\", this application will be installed for this user. If \"FALSE\", this application will not be installed for this user. If \"KEEP\" or not set, the current value is kept. If \"REMOVE\", it will be removed from user settings and the pod level setting's value will be used.. [optional] if omitted the server will use the default value of "KEEP" # noqa: E501 - product (Product): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserAppEntitlementPatch from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "appId": obj.get("appId"), + "listed": obj.get("listed") if obj.get("listed") is not None else 'KEEP', + "install": obj.get("install") if obj.get("install") is not None else 'KEEP', + "product": Product.from_dict(obj["product"]) if obj.get("product") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.app_id: str = app_id - self.listed: str = "KEEP" - self.install: str = "KEEP" - self.product: Product = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_app_entitlement_patch_enum.py b/symphony/bdk/gen/pod_model/user_app_entitlement_patch_enum.py index 20fb3b01..2d19a671 100644 --- a/symphony/bdk/gen/pod_model/user_app_entitlement_patch_enum.py +++ b/symphony/bdk/gen/pod_model/user_app_entitlement_patch_enum.py @@ -1,262 +1,97 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserAppEntitlementPatchEnum(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('type',): { - 'TRUE': "TRUE", - 'FALSE': "FALSE", - 'KEEP': "KEEP", - 'REMOVE': "REMOVE", - }, - } - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - _nullable = False +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +class UserAppEntitlementPatchEnum(BaseModel): + """ + UserAppEntitlementPatchEnum + """ # noqa: E501 + type: Optional[StrictStr] = Field(default=None, description="UserAppEntitlementPatchEnum type : * TRUE - The parameter should be set to true. * FALSE - The parameter should be set to false. * KEEP - The parameter should not be updated, the current value will be kept. * REMOVE - The parameter should be reverted to tenant level's value. ") + __properties: ClassVar[List[str]] = ["type"] - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str, none_type), # noqa: E501 - } + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value - @cached_property - def discriminator(): - return None + if value not in set(['TRUE', 'FALSE', 'KEEP', 'REMOVE']): + raise ValueError("must be one of enum values ('TRUE', 'FALSE', 'KEEP', 'REMOVE')") + return value + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'type': 'type', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserAppEntitlementPatchEnum - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): UserAppEntitlementPatchEnum type : * TRUE - The parameter should be set to true. * FALSE - The parameter should be set to false. * KEEP - The parameter should not be updated, the current value will be kept. * REMOVE - The parameter should be reverted to tenant level's value. . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserAppEntitlementPatchEnum from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserAppEntitlementPatchEnum - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): UserAppEntitlementPatchEnum type : * TRUE - The parameter should be set to true. * FALSE - The parameter should be set to false. * KEEP - The parameter should not be updated, the current value will be kept. * REMOVE - The parameter should be reverted to tenant level's value. . [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserAppEntitlementPatchEnum from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_app_entitlements_patch_list.py b/symphony/bdk/gen/pod_model/user_app_entitlements_patch_list.py deleted file mode 100644 index f7cf9210..00000000 --- a/symphony/bdk/gen/pod_model/user_app_entitlements_patch_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.user_app_entitlement_patch import UserAppEntitlementPatch -globals()['UserAppEntitlementPatch'] = UserAppEntitlementPatch - -class UserAppEntitlementsPatchList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([UserAppEntitlementPatch],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """UserAppEntitlementsPatchList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([UserAppEntitlementPatch]): Array of app entitlements to patch for a user. # noqa: E501 - - Keyword Args: - value ([UserAppEntitlementPatch]): Array of app entitlements to patch for a user. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[UserAppEntitlementPatch] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """UserAppEntitlementsPatchList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([UserAppEntitlementPatch]): Array of app entitlements to patch for a user. # noqa: E501 - - Keyword Args: - value ([UserAppEntitlementPatch]): Array of app entitlements to patch for a user. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/user_attributes.py b/symphony/bdk/gen/pod_model/user_attributes.py index 9295874b..277260ae 100644 --- a/symphony/bdk/gen/pod_model/user_attributes.py +++ b/symphony/bdk/gen/pod_model/user_attributes.py @@ -1,341 +1,129 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('account_type',): { - 'NORMAL': "NORMAL", - 'SYSTEM': "SYSTEM", - 'SDL': "SDL", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'email_address': (str, none_type), # noqa: E501 - 'first_name': (str, none_type), # noqa: E501 - 'last_name': (str, none_type), # noqa: E501 - 'user_name': (str, none_type), # noqa: E501 - 'display_name': (str, none_type), # noqa: E501 - 'company_name': (str, none_type), # noqa: E501 - 'department': (str, none_type), # noqa: E501 - 'division': (str, none_type), # noqa: E501 - 'title': (str, none_type), # noqa: E501 - 'work_phone_number': (str, none_type), # noqa: E501 - 'mobile_phone_number': (str, none_type), # noqa: E501 - 'sms_number': (str, none_type), # noqa: E501 - 'account_type': (str, none_type), # noqa: E501 - 'location': (str, none_type), # noqa: E501 - 'job_function': (str, none_type), # noqa: E501 - 'asset_classes': ([str], none_type), # noqa: E501 - 'industries': ([str], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'email_address': 'emailAddress', # noqa: E501 - 'first_name': 'firstName', # noqa: E501 - 'last_name': 'lastName', # noqa: E501 - 'user_name': 'userName', # noqa: E501 - 'display_name': 'displayName', # noqa: E501 - 'company_name': 'companyName', # noqa: E501 - 'department': 'department', # noqa: E501 - 'division': 'division', # noqa: E501 - 'title': 'title', # noqa: E501 - 'work_phone_number': 'workPhoneNumber', # noqa: E501 - 'mobile_phone_number': 'mobilePhoneNumber', # noqa: E501 - 'sms_number': 'smsNumber', # noqa: E501 - 'account_type': 'accountType', # noqa: E501 - 'location': 'location', # noqa: E501 - 'job_function': 'jobFunction', # noqa: E501 - 'asset_classes': 'assetClasses', # noqa: E501 - 'industries': 'industries', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class UserAttributes(BaseModel): + """ + User record. + """ # noqa: E501 + email_address: Optional[StrictStr] = Field(default=None, alias="emailAddress") + first_name: Optional[StrictStr] = Field(default=None, alias="firstName") + last_name: Optional[StrictStr] = Field(default=None, alias="lastName") + user_name: Optional[StrictStr] = Field(default=None, alias="userName") + display_name: Optional[StrictStr] = Field(default=None, alias="displayName") + company_name: Optional[StrictStr] = Field(default=None, alias="companyName") + department: Optional[StrictStr] = None + division: Optional[StrictStr] = None + title: Optional[StrictStr] = None + work_phone_number: Optional[StrictStr] = Field(default=None, alias="workPhoneNumber") + mobile_phone_number: Optional[StrictStr] = Field(default=None, alias="mobilePhoneNumber") + sms_number: Optional[StrictStr] = Field(default=None, alias="smsNumber") + account_type: Optional[StrictStr] = Field(default=None, alias="accountType") + location: Optional[StrictStr] = None + job_function: Optional[StrictStr] = Field(default=None, alias="jobFunction") + asset_classes: Optional[List[StrictStr]] = Field(default=None, alias="assetClasses") + industries: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["emailAddress", "firstName", "lastName", "userName", "displayName", "companyName", "department", "division", "title", "workPhoneNumber", "mobilePhoneNumber", "smsNumber", "accountType", "location", "jobFunction", "assetClasses", "industries"] + + @field_validator('account_type') + def account_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['NORMAL', 'SYSTEM', 'SDL']): + raise ValueError("must be one of enum values ('NORMAL', 'SYSTEM', 'SDL')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserAttributes - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - email_address (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - user_name (str): [optional] # noqa: E501 - display_name (str): [optional] # noqa: E501 - company_name (str): [optional] # noqa: E501 - department (str): [optional] # noqa: E501 - division (str): [optional] # noqa: E501 - title (str): [optional] # noqa: E501 - work_phone_number (str): [optional] # noqa: E501 - mobile_phone_number (str): [optional] # noqa: E501 - sms_number (str): [optional] # noqa: E501 - account_type (str): [optional] # noqa: E501 - location (str): [optional] # noqa: E501 - job_function (str): [optional] # noqa: E501 - asset_classes ([str]): [optional] # noqa: E501 - industries ([str]): [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - email_address (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - user_name (str): [optional] # noqa: E501 - display_name (str): [optional] # noqa: E501 - company_name (str): [optional] # noqa: E501 - department (str): [optional] # noqa: E501 - division (str): [optional] # noqa: E501 - title (str): [optional] # noqa: E501 - work_phone_number (str): [optional] # noqa: E501 - mobile_phone_number (str): [optional] # noqa: E501 - sms_number (str): [optional] # noqa: E501 - account_type (str): [optional] # noqa: E501 - location (str): [optional] # noqa: E501 - job_function (str): [optional] # noqa: E501 - asset_classes ([str]): [optional] # noqa: E501 - industries ([str]): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserAttributes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "emailAddress": obj.get("emailAddress"), + "firstName": obj.get("firstName"), + "lastName": obj.get("lastName"), + "userName": obj.get("userName"), + "displayName": obj.get("displayName"), + "companyName": obj.get("companyName"), + "department": obj.get("department"), + "division": obj.get("division"), + "title": obj.get("title"), + "workPhoneNumber": obj.get("workPhoneNumber"), + "mobilePhoneNumber": obj.get("mobilePhoneNumber"), + "smsNumber": obj.get("smsNumber"), + "accountType": obj.get("accountType"), + "location": obj.get("location"), + "jobFunction": obj.get("jobFunction"), + "assetClasses": obj.get("assetClasses"), + "industries": obj.get("industries") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.email_address: str = None - self.first_name: str = None - self.last_name: str = None - self.user_name: str = None - self.display_name: str = None - self.company_name: str = None - self.department: str = None - self.division: str = None - self.title: str = None - self.work_phone_number: str = None - self.mobile_phone_number: str = None - self.sms_number: str = None - self.account_type: str = None - self.location: str = None - self.job_function: str = None - self.asset_classes: List[str] = None - self.industries: List[str] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_compp.py b/symphony/bdk/gen/pod_model/user_compp.py index da48fe76..e9e521e5 100644 --- a/symphony/bdk/gen/pod_model/user_compp.py +++ b/symphony/bdk/gen/pod_model/user_compp.py @@ -1,276 +1,95 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class UserCompp(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserCompp(BaseModel): """ + Basic user information to include in other models + """ # noqa: E501 + id: Optional[StrictInt] = Field(default=None, description="User ID") + username: Optional[StrictStr] = Field(default=None, description="Username") + first_name: Optional[StrictStr] = Field(default=None, description="User first name", alias="firstName") + last_name: Optional[StrictStr] = Field(default=None, description="User last name", alias="lastName") + email_address: Optional[StrictStr] = Field(default=None, description="User email addressIntegrationUserManagerTest", alias="emailAddress") + __properties: ClassVar[List[str]] = ["id", "username", "firstName", "lastName", "emailAddress"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserCompp from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (int, none_type), # noqa: E501 - 'username': (str, none_type), # noqa: E501 - 'first_name': (str, none_type), # noqa: E501 - 'last_name': (str, none_type), # noqa: E501 - 'email_address': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'id': 'id', # noqa: E501 - 'username': 'username', # noqa: E501 - 'first_name': 'firstName', # noqa: E501 - 'last_name': 'lastName', # noqa: E501 - 'email_address': 'emailAddress', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserCompp - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): User ID. [optional] # noqa: E501 - username (str): Username. [optional] # noqa: E501 - first_name (str): User first name. [optional] # noqa: E501 - last_name (str): User last name. [optional] # noqa: E501 - email_address (str): User email addressIntegrationUserManagerTest. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserCompp - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): User ID. [optional] # noqa: E501 - username (str): Username. [optional] # noqa: E501 - first_name (str): User first name. [optional] # noqa: E501 - last_name (str): User last name. [optional] # noqa: E501 - email_address (str): User email addressIntegrationUserManagerTest. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserCompp from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "username": obj.get("username"), + "firstName": obj.get("firstName"), + "lastName": obj.get("lastName"), + "emailAddress": obj.get("emailAddress") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: int = None - self.username: str = None - self.first_name: str = None - self.last_name: str = None - self.email_address: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_connection.py b/symphony/bdk/gen/pod_model/user_connection.py index 0217ddd1..ca0923b3 100644 --- a/symphony/bdk/gen/pod_model/user_connection.py +++ b/symphony/bdk/gen/pod_model/user_connection.py @@ -1,282 +1,105 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class UserConnection(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserConnection(BaseModel): """ + Connection status between two users + """ # noqa: E501 + user_id: Optional[StrictInt] = Field(default=None, description="user id", alias="userId") + status: Optional[StrictStr] = Field(default=None, description="Connection status between the requesting user and the request sender") + first_requested_at: Optional[StrictInt] = Field(default=None, description="unix timestamp when the first request was made", alias="firstRequestedAt") + updated_at: Optional[StrictInt] = Field(default=None, description="unix timestamp on the last updated date", alias="updatedAt") + request_counter: Optional[StrictInt] = Field(default=None, description="number of requests made", alias="requestCounter") + __properties: ClassVar[List[str]] = ["userId", "status", "firstRequestedAt", "updatedAt", "requestCounter"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['PENDING_INCOMING', 'PENDING_OUTGOING', 'ACCEPTED', 'REJECTED']): + raise ValueError("must be one of enum values ('PENDING_INCOMING', 'PENDING_OUTGOING', 'ACCEPTED', 'REJECTED')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('status',): { - 'PENDING_INCOMING': "PENDING_INCOMING", - 'PENDING_OUTGOING': "PENDING_OUTGOING", - 'ACCEPTED': "ACCEPTED", - 'REJECTED': "REJECTED", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserConnection from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'user_id': (int, none_type), # noqa: E501 - 'status': (str, none_type), # noqa: E501 - 'first_requested_at': (int, none_type), # noqa: E501 - 'updated_at': (int, none_type), # noqa: E501 - 'request_counter': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'user_id': 'userId', # noqa: E501 - 'status': 'status', # noqa: E501 - 'first_requested_at': 'firstRequestedAt', # noqa: E501 - 'updated_at': 'updatedAt', # noqa: E501 - 'request_counter': 'requestCounter', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserConnection - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): user id. [optional] # noqa: E501 - status (str): Connection status between the requesting user and the request sender. [optional] # noqa: E501 - first_requested_at (int): unix timestamp when the first request was made. [optional] # noqa: E501 - updated_at (int): unix timestamp on the last updated date. [optional] # noqa: E501 - request_counter (int): number of requests made. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserConnection - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): user id. [optional] # noqa: E501 - status (str): Connection status between the requesting user and the request sender. [optional] # noqa: E501 - first_requested_at (int): unix timestamp when the first request was made. [optional] # noqa: E501 - updated_at (int): unix timestamp on the last updated date. [optional] # noqa: E501 - request_counter (int): number of requests made. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserConnection from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "userId": obj.get("userId"), + "status": obj.get("status"), + "firstRequestedAt": obj.get("firstRequestedAt"), + "updatedAt": obj.get("updatedAt"), + "requestCounter": obj.get("requestCounter") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_id: int = None - self.status: str = None - self.first_requested_at: int = None - self.updated_at: int = None - self.request_counter: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_connection_list.py b/symphony/bdk/gen/pod_model/user_connection_list.py deleted file mode 100644 index a2094963..00000000 --- a/symphony/bdk/gen/pod_model/user_connection_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.user_connection import UserConnection -globals()['UserConnection'] = UserConnection - -class UserConnectionList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([UserConnection],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """UserConnectionList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([UserConnection]): # noqa: E501 - - Keyword Args: - value ([UserConnection]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[UserConnection] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """UserConnectionList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([UserConnection]): # noqa: E501 - - Keyword Args: - value ([UserConnection]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/user_connection_request.py b/symphony/bdk/gen/pod_model/user_connection_request.py index cc3e8572..6ac16780 100644 --- a/symphony/bdk/gen/pod_model/user_connection_request.py +++ b/symphony/bdk/gen/pod_model/user_connection_request.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserConnectionRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_id': (int, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class UserConnectionRequest(BaseModel): + """ + Request body for the Connection APIs + """ # noqa: E501 + user_id: Optional[StrictInt] = Field(default=None, description="user id", alias="userId") + __properties: ClassVar[List[str]] = ["userId"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'user_id': 'userId', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserConnectionRequest - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): user id. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserConnectionRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserConnectionRequest - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): user id. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserConnectionRequest from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "userId": obj.get("userId") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_id: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_create.py b/symphony/bdk/gen/pod_model/user_create.py deleted file mode 100644 index 74680c61..00000000 --- a/symphony/bdk/gen/pod_model/user_create.py +++ /dev/null @@ -1,180 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - -from symphony.bdk.gen.pod_model.password import Password -from symphony.bdk.gen.pod_model.user_attributes import UserAttributes -globals()['Password'] = Password -globals()['UserAttributes'] = UserAttributes - - -class UserCreate(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_attributes': (UserAttributes, none_type), # noqa: E501 - 'password': (Password, none_type), # noqa: E501 - 'roles': ([str], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user_attributes': 'userAttributes', # noqa: E501 - 'password': 'password', # noqa: E501 - 'roles': 'roles', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserCreate - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_attributes (UserAttributes): [optional] # noqa: E501 - password (Password): [optional] # noqa: E501 - roles ([str]): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_attributes: UserAttributes = None - self.password: Password = None - self.roles: List[str] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/user_data.py b/symphony/bdk/gen/pod_model/user_data.py index 5216146f..1dabd5de 100644 --- a/symphony/bdk/gen/pod_model/user_data.py +++ b/symphony/bdk/gen/pod_model/user_data.py @@ -1,276 +1,95 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class UserData(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserData(BaseModel): """ + User object response + """ # noqa: E501 + id: Optional[StrictInt] = None + username: Optional[StrictStr] = None + first_name: Optional[StrictStr] = Field(default=None, alias="firstName") + last_name: Optional[StrictStr] = Field(default=None, alias="lastName") + email_address: Optional[StrictStr] = Field(default=None, alias="emailAddress") + __properties: ClassVar[List[str]] = ["id", "username", "firstName", "lastName", "emailAddress"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserData from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (int, none_type), # noqa: E501 - 'username': (str, none_type), # noqa: E501 - 'first_name': (str, none_type), # noqa: E501 - 'last_name': (str, none_type), # noqa: E501 - 'email_address': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'id': 'id', # noqa: E501 - 'username': 'username', # noqa: E501 - 'first_name': 'firstName', # noqa: E501 - 'last_name': 'lastName', # noqa: E501 - 'email_address': 'emailAddress', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserData - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - username (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - email_address (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserData - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - username (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - email_address (str): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserData from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "username": obj.get("username"), + "firstName": obj.get("firstName"), + "lastName": obj.get("lastName"), + "emailAddress": obj.get("emailAddress") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: int = None - self.username: str = None - self.first_name: str = None - self.last_name: str = None - self.email_address: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_detail.py b/symphony/bdk/gen/pod_model/user_detail.py index e3f16e45..9ca41b5b 100644 --- a/symphony/bdk/gen/pod_model/user_detail.py +++ b/symphony/bdk/gen/pod_model/user_detail.py @@ -1,302 +1,113 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.avatar import Avatar -from symphony.bdk.gen.pod_model.integer_list import IntegerList -from symphony.bdk.gen.pod_model.string_list import StringList from symphony.bdk.gen.pod_model.user_attributes import UserAttributes from symphony.bdk.gen.pod_model.user_system_info import UserSystemInfo -globals()['Avatar'] = Avatar -globals()['IntegerList'] = IntegerList -globals()['StringList'] = StringList -globals()['UserAttributes'] = UserAttributes -globals()['UserSystemInfo'] = UserSystemInfo - -class UserDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserDetail(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_attributes': (UserAttributes, none_type), # noqa: E501 - 'user_system_info': (UserSystemInfo, none_type), # noqa: E501 - 'features': (IntegerList, none_type), # noqa: E501 - 'apps': (IntegerList, none_type), # noqa: E501 - 'groups': (IntegerList, none_type), # noqa: E501 - 'roles': (StringList, none_type), # noqa: E501 - 'disclaimers': (IntegerList, none_type), # noqa: E501 - 'avatar': (Avatar, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user_attributes': 'userAttributes', # noqa: E501 - 'user_system_info': 'userSystemInfo', # noqa: E501 - 'features': 'features', # noqa: E501 - 'apps': 'apps', # noqa: E501 - 'groups': 'groups', # noqa: E501 - 'roles': 'roles', # noqa: E501 - 'disclaimers': 'disclaimers', # noqa: E501 - 'avatar': 'avatar', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + Detailed User record. + """ # noqa: E501 + user_attributes: Optional[UserAttributes] = Field(default=None, alias="userAttributes") + user_system_info: Optional[UserSystemInfo] = Field(default=None, alias="userSystemInfo") + features: Optional[List[StrictInt]] = None + apps: Optional[List[StrictInt]] = None + groups: Optional[List[StrictInt]] = None + roles: Optional[List[StrictStr]] = None + disclaimers: Optional[List[StrictInt]] = None + avatar: Optional[Avatar] = None + __properties: ClassVar[List[str]] = ["userAttributes", "userSystemInfo", "features", "apps", "groups", "roles", "disclaimers", "avatar"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_attributes (UserAttributes): [optional] # noqa: E501 - user_system_info (UserSystemInfo): [optional] # noqa: E501 - features (IntegerList): [optional] # noqa: E501 - apps (IntegerList): [optional] # noqa: E501 - groups (IntegerList): [optional] # noqa: E501 - roles (StringList): [optional] # noqa: E501 - disclaimers (IntegerList): [optional] # noqa: E501 - avatar (Avatar): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_attributes (UserAttributes): [optional] # noqa: E501 - user_system_info (UserSystemInfo): [optional] # noqa: E501 - features (IntegerList): [optional] # noqa: E501 - apps (IntegerList): [optional] # noqa: E501 - groups (IntegerList): [optional] # noqa: E501 - roles (StringList): [optional] # noqa: E501 - disclaimers (IntegerList): [optional] # noqa: E501 - avatar (Avatar): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user_attributes + if self.user_attributes: + _dict['userAttributes'] = self.user_attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of user_system_info + if self.user_system_info: + _dict['userSystemInfo'] = self.user_system_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of avatar + if self.avatar: + _dict['avatar'] = self.avatar.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "userAttributes": UserAttributes.from_dict(obj["userAttributes"]) if obj.get("userAttributes") is not None else None, + "userSystemInfo": UserSystemInfo.from_dict(obj["userSystemInfo"]) if obj.get("userSystemInfo") is not None else None, + "features": obj.get("features"), + "apps": obj.get("apps"), + "groups": obj.get("groups"), + "roles": obj.get("roles"), + "disclaimers": obj.get("disclaimers"), + "avatar": Avatar.from_dict(obj["avatar"]) if obj.get("avatar") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_attributes: UserAttributes = None - self.user_system_info: UserSystemInfo = None - self.features: IntegerList = None - self.apps: IntegerList = None - self.groups: IntegerList = None - self.roles: StringList = None - self.disclaimers: IntegerList = None - self.avatar: Avatar = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_detail_list.py b/symphony/bdk/gen/pod_model/user_detail_list.py deleted file mode 100644 index e76dbd2c..00000000 --- a/symphony/bdk/gen/pod_model/user_detail_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.user_detail import UserDetail -globals()['UserDetail'] = UserDetail - -class UserDetailList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([UserDetail],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """UserDetailList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([UserDetail]): # noqa: E501 - - Keyword Args: - value ([UserDetail]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[UserDetail] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """UserDetailList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([UserDetail]): # noqa: E501 - - Keyword Args: - value ([UserDetail]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/user_error.py b/symphony/bdk/gen/pod_model/user_error.py index add862db..8e378ac1 100644 --- a/symphony/bdk/gen/pod_model/user_error.py +++ b/symphony/bdk/gen/pod_model/user_error.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserError(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'error': (str, none_type), # noqa: E501 - 'email': (str, none_type), # noqa: E501 - 'id': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class UserError(BaseModel): + """ + User error information + """ # noqa: E501 + error: Optional[StrictStr] = Field(default=None, description="Error code informing what is wrong") + email: Optional[StrictStr] = Field(default=None, description="Email with error. Only one of the following fields should be present: email or id") + id: Optional[StrictStr] = Field(default=None, description="Id with error. Only one of the following fields should be present: email or id") + __properties: ClassVar[List[str]] = ["error", "email", "id"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'error': 'error', # noqa: E501 - 'email': 'email', # noqa: E501 - 'id': 'id', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserError - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - error (str): Error code informing what is wrong. [optional] # noqa: E501 - email (str): Email with error. Only one of the following fields should be present: email or id. [optional] # noqa: E501 - id (str): Id with error. Only one of the following fields should be present: email or id. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserError from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserError - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - error (str): Error code informing what is wrong. [optional] # noqa: E501 - email (str): Email with error. Only one of the following fields should be present: email or id. [optional] # noqa: E501 - id (str): Id with error. Only one of the following fields should be present: email or id. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserError from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "error": obj.get("error"), + "email": obj.get("email"), + "id": obj.get("id") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.error: str = None - self.email: str = None - self.id: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_filter.py b/symphony/bdk/gen/pod_model/user_filter.py index f275e541..6de50b02 100644 --- a/symphony/bdk/gen/pod_model/user_filter.py +++ b/symphony/bdk/gen/pod_model/user_filter.py @@ -1,270 +1,101 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class UserFilter(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserFilter(BaseModel): """ + UserFilter + """ # noqa: E501 + role: Optional[StrictStr] = Field(default=None, description="The user role") + feature: Optional[StrictStr] = None + status: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["role", "feature", "status"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ENABLED', 'DISABLED']): + raise ValueError("must be one of enum values ('ENABLED', 'DISABLED')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('status',): { - 'ENABLED': "ENABLED", - 'DISABLED': "DISABLED", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'role': (str, none_type), # noqa: E501 - 'feature': (str, none_type), # noqa: E501 - 'status': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'role': 'role', # noqa: E501 - 'feature': 'feature', # noqa: E501 - 'status': 'status', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserFilter - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - role (str): The user role. [optional] # noqa: E501 - feature (str): [optional] # noqa: E501 - status (str): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserFilter - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - role (str): The user role. [optional] # noqa: E501 - feature (str): [optional] # noqa: E501 - status (str): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserFilter from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "role": obj.get("role"), + "feature": obj.get("feature"), + "status": obj.get("status") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.role: str = None - self.feature: str = None - self.status: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_assignee.py b/symphony/bdk/gen/pod_model/user_group_assignee.py index a63ad1b6..1179e067 100644 --- a/symphony/bdk/gen/pod_model/user_group_assignee.py +++ b/symphony/bdk/gen/pod_model/user_group_assignee.py @@ -1,301 +1,111 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.group_role_scope import GroupRoleScope from symphony.bdk.gen.pod_model.user_compp import UserCompp -globals()['GroupRoleScope'] = GroupRoleScope -globals()['UserCompp'] = UserCompp - -class UserGroupAssignee(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserGroupAssignee(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'group_id': (str, none_type), # noqa: E501 - 'group': (GroupRoleScope, none_type), # noqa: E501 - 'user_id': (int, none_type), # noqa: E501 - 'user': (UserCompp, none_type), # noqa: E501 - 'user_roles': ([str], none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'last_added_date': (int, none_type), # noqa: E501 - 'last_removed_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'group_id': 'groupId', # noqa: E501 - 'group': 'group', # noqa: E501 - 'user_id': 'userId', # noqa: E501 - 'user': 'user', # noqa: E501 - 'user_roles': 'userRoles', # noqa: E501 - 'active': 'active', # noqa: E501 - 'last_added_date': 'lastAddedDate', # noqa: E501 - 'last_removed_date': 'lastRemovedDate', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + User group assignee object + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assignee id") + group_id: Optional[StrictStr] = Field(default=None, alias="groupId") + group: Optional[GroupRoleScope] = None + user_id: Optional[StrictInt] = Field(default=None, alias="userId") + user: Optional[UserCompp] = None + user_roles: Optional[List[StrictStr]] = Field(default=None, alias="userRoles") + active: Optional[StrictBool] = None + last_added_date: Optional[StrictInt] = Field(default=None, description="Last added", alias="lastAddedDate") + last_removed_date: Optional[StrictInt] = Field(default=None, description="Last removed", alias="lastRemovedDate") + __properties: ClassVar[List[str]] = ["id", "groupId", "group", "userId", "user", "userRoles", "active", "lastAddedDate", "lastRemovedDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupAssignee - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Assignee id. [optional] # noqa: E501 - group_id (str): [optional] # noqa: E501 - group (GroupRoleScope): [optional] # noqa: E501 - user_id (int): [optional] # noqa: E501 - user (UserCompp): [optional] # noqa: E501 - user_roles ([str]): [optional] # noqa: E501 - active (bool): [optional] # noqa: E501 - last_added_date (int): Last added. [optional] # noqa: E501 - last_removed_date (int): Last removed. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupAssignee from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupAssignee - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Assignee id. [optional] # noqa: E501 - group_id (str): [optional] # noqa: E501 - group (GroupRoleScope): [optional] # noqa: E501 - user_id (int): [optional] # noqa: E501 - user (UserCompp): [optional] # noqa: E501 - user_roles ([str]): [optional] # noqa: E501 - active (bool): [optional] # noqa: E501 - last_added_date (int): Last added. [optional] # noqa: E501 - last_removed_date (int): Last removed. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of group + if self.group: + _dict['group'] = self.group.to_dict() + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupAssignee from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "groupId": obj.get("groupId"), + "group": GroupRoleScope.from_dict(obj["group"]) if obj.get("group") is not None else None, + "userId": obj.get("userId"), + "user": UserCompp.from_dict(obj["user"]) if obj.get("user") is not None else None, + "userRoles": obj.get("userRoles"), + "active": obj.get("active"), + "lastAddedDate": obj.get("lastAddedDate"), + "lastRemovedDate": obj.get("lastRemovedDate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.group_id: str = None - self.group: GroupRoleScope = None - self.user_id: int = None - self.user: UserCompp = None - self.user_roles: List[str] = None - self.active: bool = None - self.last_added_date: int = None - self.last_removed_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_assignee_response.py b/symphony/bdk/gen/pod_model/user_group_assignee_response.py index 3f565e74..6f846d76 100644 --- a/symphony/bdk/gen/pod_model/user_group_assignee_response.py +++ b/symphony/bdk/gen/pod_model/user_group_assignee_response.py @@ -1,266 +1,101 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.pagination import Pagination from symphony.bdk.gen.pod_model.user_group_assignee import UserGroupAssignee -globals()['Pagination'] = Pagination -globals()['UserGroupAssignee'] = UserGroupAssignee +from typing import Optional, Set +from typing_extensions import Self -class UserGroupAssigneeResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserGroupAssigneeResponse(BaseModel): """ + response + """ # noqa: E501 + data: Optional[List[UserGroupAssignee]] = None + pagination: Optional[Pagination] = None + __properties: ClassVar[List[str]] = ["data", "pagination"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'data': ([UserGroupAssignee], none_type), # noqa: E501 - 'pagination': (Pagination, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'data': 'data', # noqa: E501 - 'pagination': 'pagination', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupAssigneeResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data ([UserGroupAssignee]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupAssigneeResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupAssigneeResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data ([UserGroupAssignee]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupAssigneeResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "data": [UserGroupAssignee.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.data: List[UserGroupAssignee] = None - self.pagination: Pagination = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_assignee_update.py b/symphony/bdk/gen/pod_model/user_group_assignee_update.py index a0821e82..5457cdcd 100644 --- a/symphony/bdk/gen/pod_model/user_group_assignee_update.py +++ b/symphony/bdk/gen/pod_model/user_group_assignee_update.py @@ -1,261 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserGroupAssigneeUpdate(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'current': (bool,), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class UserGroupAssigneeUpdate(BaseModel): + """ + Body for user group assignee update + """ # noqa: E501 + current: StrictBool = Field(description="Assignee status") + __properties: ClassVar[List[str]] = ["current"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'current': 'current', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, current, *args, **kwargs): # noqa: E501 - """UserGroupAssigneeUpdate - a pod_model defined in OpenAPI - - Args: - current (bool): Assignee status - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupAssigneeUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.current = current - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, current, *args, **kwargs): # noqa: E501 - """UserGroupAssigneeUpdate - a pod_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - current (bool): Assignee status + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupAssigneeUpdate from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "current": obj.get("current") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.current: bool = current - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_assignment_response.py b/symphony/bdk/gen/pod_model/user_group_assignment_response.py index 4020d352..5a03b8ff 100644 --- a/symphony/bdk/gen/pod_model/user_group_assignment_response.py +++ b/symphony/bdk/gen/pod_model/user_group_assignment_response.py @@ -1,301 +1,111 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.group_role_scope import GroupRoleScope from symphony.bdk.gen.pod_model.user_compp import UserCompp -globals()['GroupRoleScope'] = GroupRoleScope -globals()['UserCompp'] = UserCompp - -class UserGroupAssignmentResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserGroupAssignmentResponse(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'group_id': (str, none_type), # noqa: E501 - 'group': (GroupRoleScope, none_type), # noqa: E501 - 'user_id': (int, none_type), # noqa: E501 - 'user': (UserCompp, none_type), # noqa: E501 - 'user_roles': ([str], none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'last_added_date': (int, none_type), # noqa: E501 - 'last_removed_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'group_id': 'groupId', # noqa: E501 - 'group': 'group', # noqa: E501 - 'user_id': 'userId', # noqa: E501 - 'user': 'user', # noqa: E501 - 'user_roles': 'userRoles', # noqa: E501 - 'active': 'active', # noqa: E501 - 'last_added_date': 'lastAddedDate', # noqa: E501 - 'last_removed_date': 'lastRemovedDate', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + User Group assignment response object + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Assignment ID") + group_id: Optional[StrictStr] = Field(default=None, description="Group ID", alias="groupId") + group: Optional[GroupRoleScope] = None + user_id: Optional[StrictInt] = Field(default=None, description="User ID", alias="userId") + user: Optional[UserCompp] = None + user_roles: Optional[List[StrictStr]] = Field(default=None, alias="userRoles") + active: Optional[StrictBool] = Field(default=None, description="Group membership status") + last_added_date: Optional[StrictInt] = Field(default=None, description="Date of group membership last added", alias="lastAddedDate") + last_removed_date: Optional[StrictInt] = Field(default=None, description="Date of group membership last removed", alias="lastRemovedDate") + __properties: ClassVar[List[str]] = ["id", "groupId", "group", "userId", "user", "userRoles", "active", "lastAddedDate", "lastRemovedDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupAssignmentResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Assignment ID. [optional] # noqa: E501 - group_id (str): Group ID. [optional] # noqa: E501 - group (GroupRoleScope): [optional] # noqa: E501 - user_id (int): User ID. [optional] # noqa: E501 - user (UserCompp): [optional] # noqa: E501 - user_roles ([str]): [optional] # noqa: E501 - active (bool): Group membership status. [optional] # noqa: E501 - last_added_date (int): Date of group membership last added. [optional] # noqa: E501 - last_removed_date (int): Date of group membership last removed. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupAssignmentResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupAssignmentResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Assignment ID. [optional] # noqa: E501 - group_id (str): Group ID. [optional] # noqa: E501 - group (GroupRoleScope): [optional] # noqa: E501 - user_id (int): User ID. [optional] # noqa: E501 - user (UserCompp): [optional] # noqa: E501 - user_roles ([str]): [optional] # noqa: E501 - active (bool): Group membership status. [optional] # noqa: E501 - last_added_date (int): Date of group membership last added. [optional] # noqa: E501 - last_removed_date (int): Date of group membership last removed. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of group + if self.group: + _dict['group'] = self.group.to_dict() + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupAssignmentResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "groupId": obj.get("groupId"), + "group": GroupRoleScope.from_dict(obj["group"]) if obj.get("group") is not None else None, + "userId": obj.get("userId"), + "user": UserCompp.from_dict(obj["user"]) if obj.get("user") is not None else None, + "userRoles": obj.get("userRoles"), + "active": obj.get("active"), + "lastAddedDate": obj.get("lastAddedDate"), + "lastRemovedDate": obj.get("lastRemovedDate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.group_id: str = None - self.group: GroupRoleScope = None - self.user_id: int = None - self.user: UserCompp = None - self.user_roles: List[str] = None - self.active: bool = None - self.last_added_date: int = None - self.last_removed_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_create.py b/symphony/bdk/gen/pod_model/user_group_create.py index f714153d..465a1c38 100644 --- a/symphony/bdk/gen/pod_model/user_group_create.py +++ b/symphony/bdk/gen/pod_model/user_group_create.py @@ -1,277 +1,93 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class UserGroupCreate(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserGroupCreate(BaseModel): """ + Body for group creation + """ # noqa: E501 + name: StrictStr = Field(description="Group name") + area: Optional[StrictStr] = Field(default=None, description="Group area") + description: Optional[StrictStr] = Field(default=None, description="Group description") + type: StrictStr = Field(description="Group type") + __properties: ClassVar[List[str]] = ["name", "area", "description", "type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupCreate from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'name': (str,), # noqa: E501 - 'type': (str,), # noqa: E501 - 'area': (str, none_type), # noqa: E501 - 'description': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - + excluded_fields: Set[str] = set([ + ]) - attribute_map = { - 'name': 'name', # noqa: E501 - 'type': 'type', # noqa: E501 - 'area': 'area', # noqa: E501 - 'description': 'description', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, name, type, *args, **kwargs): # noqa: E501 - """UserGroupCreate - a pod_model defined in OpenAPI - - Args: - name (str): Group name - type (str): Group type - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - area (str): Group area. [optional] # noqa: E501 - description (str): Group description. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - self.type = type - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, name, type, *args, **kwargs): # noqa: E501 - """UserGroupCreate - a pod_model defined in OpenAPI - - Args: - name (str): Group name - type (str): Group type - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - area (str): Group area. [optional] # noqa: E501 - description (str): Group description. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupCreate from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "area": obj.get("area"), + "description": obj.get("description"), + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = name - self.type: str = type - self.area: str = None - self.description: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_data.py b/symphony/bdk/gen/pod_model/user_group_data.py index 54575e5f..9bf49ab0 100644 --- a/symphony/bdk/gen/pod_model/user_group_data.py +++ b/symphony/bdk/gen/pod_model/user_group_data.py @@ -1,276 +1,95 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class UserGroupData(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserGroupData(BaseModel): """ + Group object response + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Group Id") + name: Optional[StrictStr] = Field(default=None, description="Group name") + area: Optional[StrictStr] = Field(default=None, description="Group area") + type: Optional[StrictStr] = Field(default=None, description="Group type") + active: Optional[StrictBool] = Field(default=None, description="Group Status") + __properties: ClassVar[List[str]] = ["id", "name", "area", "type", "active"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupData from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'id': (str, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'area': (str, none_type), # noqa: E501 - 'type': (str, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - 'area': 'area', # noqa: E501 - 'type': 'type', # noqa: E501 - 'active': 'active', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupData - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group Id. [optional] # noqa: E501 - name (str): Group name. [optional] # noqa: E501 - area (str): Group area. [optional] # noqa: E501 - type (str): Group type. [optional] # noqa: E501 - active (bool): Group Status. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupData - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group Id. [optional] # noqa: E501 - name (str): Group name. [optional] # noqa: E501 - area (str): Group area. [optional] # noqa: E501 - type (str): Group type. [optional] # noqa: E501 - active (bool): Group Status. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupData from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "area": obj.get("area"), + "type": obj.get("type"), + "active": obj.get("active") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.name: str = None - self.area: str = None - self.type: str = None - self.active: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_membership_data.py b/symphony/bdk/gen/pod_model/user_group_membership_data.py index e4e4d733..89f02051 100644 --- a/symphony/bdk/gen/pod_model/user_group_membership_data.py +++ b/symphony/bdk/gen/pod_model/user_group_membership_data.py @@ -1,296 +1,109 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.membership_data import MembershipData from symphony.bdk.gen.pod_model.user_group_data import UserGroupData -globals()['MembershipData'] = MembershipData -globals()['UserGroupData'] = UserGroupData - -class UserGroupMembershipData(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserGroupMembershipData(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'group_id': (str, none_type), # noqa: E501 - 'user_id': (int, none_type), # noqa: E501 - 'group': (UserGroupData, none_type), # noqa: E501 - 'user': (MembershipData, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'last_added_date': (int, none_type), # noqa: E501 - 'last_removed_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'group_id': 'groupId', # noqa: E501 - 'user_id': 'userId', # noqa: E501 - 'group': 'group', # noqa: E501 - 'user': 'user', # noqa: E501 - 'active': 'active', # noqa: E501 - 'last_added_date': 'lastAddedDate', # noqa: E501 - 'last_removed_date': 'lastRemovedDate', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + Body for user group membership response + """ # noqa: E501 + id: Optional[StrictStr] = None + group_id: Optional[StrictStr] = Field(default=None, alias="groupId") + user_id: Optional[StrictInt] = Field(default=None, alias="userId") + group: Optional[UserGroupData] = None + user: Optional[MembershipData] = None + active: Optional[StrictBool] = None + last_added_date: Optional[StrictInt] = Field(default=None, alias="lastAddedDate") + last_removed_date: Optional[StrictInt] = Field(default=None, alias="lastRemovedDate") + __properties: ClassVar[List[str]] = ["id", "groupId", "userId", "group", "user", "active", "lastAddedDate", "lastRemovedDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupMembershipData - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - group_id (str): [optional] # noqa: E501 - user_id (int): [optional] # noqa: E501 - group (UserGroupData): [optional] # noqa: E501 - user (MembershipData): [optional] # noqa: E501 - active (bool): [optional] # noqa: E501 - last_added_date (int): [optional] # noqa: E501 - last_removed_date (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupMembershipData from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupMembershipData - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - group_id (str): [optional] # noqa: E501 - user_id (int): [optional] # noqa: E501 - group (UserGroupData): [optional] # noqa: E501 - user (MembershipData): [optional] # noqa: E501 - active (bool): [optional] # noqa: E501 - last_added_date (int): [optional] # noqa: E501 - last_removed_date (int): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of group + if self.group: + _dict['group'] = self.group.to_dict() + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupMembershipData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "groupId": obj.get("groupId"), + "userId": obj.get("userId"), + "group": UserGroupData.from_dict(obj["group"]) if obj.get("group") is not None else None, + "user": MembershipData.from_dict(obj["user"]) if obj.get("user") is not None else None, + "active": obj.get("active"), + "lastAddedDate": obj.get("lastAddedDate"), + "lastRemovedDate": obj.get("lastRemovedDate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.group_id: str = None - self.user_id: int = None - self.group: UserGroupData = None - self.user: MembershipData = None - self.active: bool = None - self.last_added_date: int = None - self.last_removed_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_membership_request.py b/symphony/bdk/gen/pod_model/user_group_membership_request.py index 233aac30..000b3caf 100644 --- a/symphony/bdk/gen/pod_model/user_group_membership_request.py +++ b/symphony/bdk/gen/pod_model/user_group_membership_request.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserGroupMembershipRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'active': (bool, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class UserGroupMembershipRequest(BaseModel): + """ + Body for user group membership creation + """ # noqa: E501 + active: Optional[StrictBool] = None + __properties: ClassVar[List[str]] = ["active"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'active': 'active', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupMembershipRequest - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - active (bool): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupMembershipRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupMembershipRequest - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - active (bool): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupMembershipRequest from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "active": obj.get("active") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.active: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_membership_response.py b/symphony/bdk/gen/pod_model/user_group_membership_response.py index 3d61ba16..70b539c7 100644 --- a/symphony/bdk/gen/pod_model/user_group_membership_response.py +++ b/symphony/bdk/gen/pod_model/user_group_membership_response.py @@ -1,266 +1,101 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.pagination import Pagination from symphony.bdk.gen.pod_model.user_group_membership_response_data import UserGroupMembershipResponseData -globals()['Pagination'] = Pagination -globals()['UserGroupMembershipResponseData'] = UserGroupMembershipResponseData +from typing import Optional, Set +from typing_extensions import Self -class UserGroupMembershipResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserGroupMembershipResponse(BaseModel): """ + UserGroupMembershipResponse + """ # noqa: E501 + data: Optional[List[UserGroupMembershipResponseData]] = None + pagination: Optional[Pagination] = None + __properties: ClassVar[List[str]] = ["data", "pagination"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'data': ([UserGroupMembershipResponseData], none_type), # noqa: E501 - 'pagination': (Pagination, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'data': 'data', # noqa: E501 - 'pagination': 'pagination', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupMembershipResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data ([UserGroupMembershipResponseData]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupMembershipResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupMembershipResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data ([UserGroupMembershipResponseData]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupMembershipResponse from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "data": [UserGroupMembershipResponseData.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.data: List[UserGroupMembershipResponseData] = None - self.pagination: Pagination = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_membership_response_data.py b/symphony/bdk/gen/pod_model/user_group_membership_response_data.py index 0d8567d7..22888786 100644 --- a/symphony/bdk/gen/pod_model/user_group_membership_response_data.py +++ b/symphony/bdk/gen/pod_model/user_group_membership_response_data.py @@ -1,296 +1,109 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.group_role_scope import GroupRoleScope from symphony.bdk.gen.pod_model.user_compp import UserCompp -globals()['GroupRoleScope'] = GroupRoleScope -globals()['UserCompp'] = UserCompp - -class UserGroupMembershipResponseData(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserGroupMembershipResponseData(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'group_id': (str, none_type), # noqa: E501 - 'group': (GroupRoleScope, none_type), # noqa: E501 - 'user_id': (int, none_type), # noqa: E501 - 'user': (UserCompp, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'last_added_date': (int, none_type), # noqa: E501 - 'last_removed_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'group_id': 'groupId', # noqa: E501 - 'group': 'group', # noqa: E501 - 'user_id': 'userId', # noqa: E501 - 'user': 'user', # noqa: E501 - 'active': 'active', # noqa: E501 - 'last_added_date': 'lastAddedDate', # noqa: E501 - 'last_removed_date': 'lastRemovedDate', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + User object response + """ # noqa: E501 + id: Optional[StrictStr] = None + group_id: Optional[StrictStr] = Field(default=None, alias="groupId") + group: Optional[GroupRoleScope] = None + user_id: Optional[StrictInt] = Field(default=None, alias="userId") + user: Optional[UserCompp] = None + active: Optional[StrictBool] = None + last_added_date: Optional[StrictInt] = Field(default=None, alias="lastAddedDate") + last_removed_date: Optional[StrictInt] = Field(default=None, alias="lastRemovedDate") + __properties: ClassVar[List[str]] = ["id", "groupId", "group", "userId", "user", "active", "lastAddedDate", "lastRemovedDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupMembershipResponseData - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - group_id (str): [optional] # noqa: E501 - group (GroupRoleScope): [optional] # noqa: E501 - user_id (int): [optional] # noqa: E501 - user (UserCompp): [optional] # noqa: E501 - active (bool): [optional] # noqa: E501 - last_added_date (int): [optional] # noqa: E501 - last_removed_date (int): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupMembershipResponseData from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupMembershipResponseData - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): [optional] # noqa: E501 - group_id (str): [optional] # noqa: E501 - group (GroupRoleScope): [optional] # noqa: E501 - user_id (int): [optional] # noqa: E501 - user (UserCompp): [optional] # noqa: E501 - active (bool): [optional] # noqa: E501 - last_added_date (int): [optional] # noqa: E501 - last_removed_date (int): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of group + if self.group: + _dict['group'] = self.group.to_dict() + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupMembershipResponseData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "groupId": obj.get("groupId"), + "group": GroupRoleScope.from_dict(obj["group"]) if obj.get("group") is not None else None, + "userId": obj.get("userId"), + "user": UserCompp.from_dict(obj["user"]) if obj.get("user") is not None else None, + "active": obj.get("active"), + "lastAddedDate": obj.get("lastAddedDate"), + "lastRemovedDate": obj.get("lastRemovedDate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.group_id: str = None - self.group: GroupRoleScope = None - self.user_id: int = None - self.user: UserCompp = None - self.active: bool = None - self.last_added_date: int = None - self.last_removed_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_membership_update.py b/symphony/bdk/gen/pod_model/user_group_membership_update.py index f547f676..d24c3e2c 100644 --- a/symphony/bdk/gen/pod_model/user_group_membership_update.py +++ b/symphony/bdk/gen/pod_model/user_group_membership_update.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserGroupMembershipUpdate(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'active': (bool, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class UserGroupMembershipUpdate(BaseModel): + """ + User Group membership update object + """ # noqa: E501 + active: Optional[StrictBool] = Field(default=None, description="Group membership status") + __properties: ClassVar[List[str]] = ["active"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'active': 'active', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupMembershipUpdate - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - active (bool): Group membership status. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupMembershipUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupMembershipUpdate - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - active (bool): Group membership status. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupMembershipUpdate from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "active": obj.get("active") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.active: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_response.py b/symphony/bdk/gen/pod_model/user_group_response.py index 3fef7f11..1020b37c 100644 --- a/symphony/bdk/gen/pod_model/user_group_response.py +++ b/symphony/bdk/gen/pod_model/user_group_response.py @@ -1,301 +1,105 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserGroupResponse(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'name': (str, none_type), # noqa: E501 - 'area': (str, none_type), # noqa: E501 - 'description': (str, none_type), # noqa: E501 - 'type': (str, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'created_date': (int, none_type), # noqa: E501 - 'modified_date': (int, none_type), # noqa: E501 - 'member_count': (int, none_type), # noqa: E501 - 'assignee_count': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'name': 'name', # noqa: E501 - 'area': 'area', # noqa: E501 - 'description': 'description', # noqa: E501 - 'type': 'type', # noqa: E501 - 'active': 'active', # noqa: E501 - 'created_date': 'createdDate', # noqa: E501 - 'modified_date': 'modifiedDate', # noqa: E501 - 'member_count': 'memberCount', # noqa: E501 - 'assignee_count': 'assigneeCount', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class UserGroupResponse(BaseModel): + """ + Group object response + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Group ID") + name: Optional[StrictStr] = Field(default=None, description="Group name") + area: Optional[StrictStr] = Field(default=None, description="An optional string attribute used for categorizing groups") + description: Optional[StrictStr] = Field(default=None, description="Group description") + type: Optional[StrictStr] = Field(default=None, description="Group type") + active: Optional[StrictBool] = Field(default=None, description="Group status") + created_date: Optional[StrictInt] = Field(default=None, description="Date of group creation", alias="createdDate") + modified_date: Optional[StrictInt] = Field(default=None, description="Date of group last update", alias="modifiedDate") + member_count: Optional[StrictInt] = Field(default=None, description="Number of group members", alias="memberCount") + assignee_count: Optional[StrictInt] = Field(default=None, description="Number of group assignees", alias="assigneeCount") + __properties: ClassVar[List[str]] = ["id", "name", "area", "description", "type", "active", "createdDate", "modifiedDate", "memberCount", "assigneeCount"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupResponse - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group ID. [optional] # noqa: E501 - name (str): Group name. [optional] # noqa: E501 - area (str): An optional string attribute used for categorizing groups. [optional] # noqa: E501 - description (str): Group description. [optional] # noqa: E501 - type (str): Group type. [optional] # noqa: E501 - active (bool): Group status. [optional] # noqa: E501 - created_date (int): Date of group creation. [optional] # noqa: E501 - modified_date (int): Date of group last update. [optional] # noqa: E501 - member_count (int): Number of group members. [optional] # noqa: E501 - assignee_count (int): Number of group assignees. [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupResponse - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): Group ID. [optional] # noqa: E501 - name (str): Group name. [optional] # noqa: E501 - area (str): An optional string attribute used for categorizing groups. [optional] # noqa: E501 - description (str): Group description. [optional] # noqa: E501 - type (str): Group type. [optional] # noqa: E501 - active (bool): Group status. [optional] # noqa: E501 - created_date (int): Date of group creation. [optional] # noqa: E501 - modified_date (int): Date of group last update. [optional] # noqa: E501 - member_count (int): Number of group members. [optional] # noqa: E501 - assignee_count (int): Number of group assignees. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "area": obj.get("area"), + "description": obj.get("description"), + "type": obj.get("type"), + "active": obj.get("active"), + "createdDate": obj.get("createdDate"), + "modifiedDate": obj.get("modifiedDate"), + "memberCount": obj.get("memberCount"), + "assigneeCount": obj.get("assigneeCount") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.name: str = None - self.area: str = None - self.description: str = None - self.type: str = None - self.active: bool = None - self.created_date: int = None - self.modified_date: int = None - self.member_count: int = None - self.assignee_count: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_response_list.py b/symphony/bdk/gen/pod_model/user_group_response_list.py index 04209bf3..67bacbc7 100644 --- a/symphony/bdk/gen/pod_model/user_group_response_list.py +++ b/symphony/bdk/gen/pod_model/user_group_response_list.py @@ -1,266 +1,101 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.pagination import Pagination from symphony.bdk.gen.pod_model.user_group_response import UserGroupResponse -globals()['Pagination'] = Pagination -globals()['UserGroupResponse'] = UserGroupResponse +from typing import Optional, Set +from typing_extensions import Self -class UserGroupResponseList(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserGroupResponseList(BaseModel): """ + UserGroupResponseList + """ # noqa: E501 + data: Optional[List[UserGroupResponse]] = None + pagination: Optional[Pagination] = None + __properties: ClassVar[List[str]] = ["data", "pagination"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'data': ([UserGroupResponse], none_type), # noqa: E501 - 'pagination': (Pagination, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'data': 'data', # noqa: E501 - 'pagination': 'pagination', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupResponseList - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data ([UserGroupResponse]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupResponseList from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupResponseList - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - data ([UserGroupResponse]): [optional] # noqa: E501 - pagination (Pagination): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupResponseList from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "data": [UserGroupResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, + "pagination": Pagination.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.data: List[UserGroupResponse] = None - self.pagination: Pagination = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_group_update.py b/symphony/bdk/gen/pod_model/user_group_update.py index 3c683e3d..f7671503 100644 --- a/symphony/bdk/gen/pod_model/user_group_update.py +++ b/symphony/bdk/gen/pod_model/user_group_update.py @@ -1,271 +1,93 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class UserGroupUpdate(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserGroupUpdate(BaseModel): """ + Body for group update + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Group name") + area: Optional[StrictStr] = Field(default=None, description="Group area") + description: Optional[StrictStr] = Field(default=None, description="Group description") + active: Optional[StrictBool] = Field(default=None, description="Group status") + __properties: ClassVar[List[str]] = ["name", "area", "description", "active"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserGroupUpdate from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'name': (str, none_type), # noqa: E501 - 'area': (str, none_type), # noqa: E501 - 'description': (str, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'name': 'name', # noqa: E501 - 'area': 'area', # noqa: E501 - 'description': 'description', # noqa: E501 - 'active': 'active', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserGroupUpdate - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Group name. [optional] # noqa: E501 - area (str): Group area. [optional] # noqa: E501 - description (str): Group description. [optional] # noqa: E501 - active (bool): Group status. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserGroupUpdate - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Group name. [optional] # noqa: E501 - area (str): Group area. [optional] # noqa: E501 - description (str): Group description. [optional] # noqa: E501 - active (bool): Group status. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserGroupUpdate from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "area": obj.get("area"), + "description": obj.get("description"), + "active": obj.get("active") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.area: str = None - self.description: str = None - self.active: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_id.py b/symphony/bdk/gen/pod_model/user_id.py index dac4d237..adbe6784 100644 --- a/symphony/bdk/gen/pod_model/user_id.py +++ b/symphony/bdk/gen/pod_model/user_id.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserId(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (int, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class UserId(BaseModel): + """ + UserId + """ # noqa: E501 + id: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["id"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'id': 'id', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserId - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserId from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserId - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserId from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "id": obj.get("id") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_id_list.py b/symphony/bdk/gen/pod_model/user_id_list.py deleted file mode 100644 index 5005298c..00000000 --- a/symphony/bdk/gen/pod_model/user_id_list.py +++ /dev/null @@ -1,278 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserIdList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([int],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """UserIdList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([int]): # noqa: E501 - - Keyword Args: - value ([int]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[int] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """UserIdList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([int]): # noqa: E501 - - Keyword Args: - value ([int]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/user_info.py b/symphony/bdk/gen/pod_model/user_info.py index 176b255e..1bd2b8d1 100644 --- a/symphony/bdk/gen/pod_model/user_info.py +++ b/symphony/bdk/gen/pod_model/user_info.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.user_attributes import UserAttributes from symphony.bdk.gen.pod_model.user_system_info import UserSystemInfo -globals()['UserAttributes'] = UserAttributes -globals()['UserSystemInfo'] = UserSystemInfo +from typing import Optional, Set +from typing_extensions import Self -class UserInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserInfo(BaseModel): """ + User record. + """ # noqa: E501 + user: Optional[UserAttributes] = None + user_system_info: Optional[UserSystemInfo] = Field(default=None, alias="userSystemInfo") + __properties: ClassVar[List[str]] = ["user", "userSystemInfo"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user': (UserAttributes, none_type), # noqa: E501 - 'user_system_info': (UserSystemInfo, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user': 'user', # noqa: E501 - 'user_system_info': 'userSystemInfo', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user (UserAttributes): [optional] # noqa: E501 - user_system_info (UserSystemInfo): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user (UserAttributes): [optional] # noqa: E501 - user_system_info (UserSystemInfo): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + # override the default output from pydantic by calling `to_dict()` of user_system_info + if self.user_system_info: + _dict['userSystemInfo'] = self.user_system_info.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserInfo from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "user": UserAttributes.from_dict(obj["user"]) if obj.get("user") is not None else None, + "userSystemInfo": UserSystemInfo.from_dict(obj["userSystemInfo"]) if obj.get("userSystemInfo") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user: UserAttributes = None - self.user_system_info: UserSystemInfo = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_name.py b/symphony/bdk/gen/pod_model/user_name.py index 3310dc63..0a8fb69c 100644 --- a/symphony/bdk/gen/pod_model/user_name.py +++ b/symphony/bdk/gen/pod_model/user_name.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserName(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'username': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class UserName(BaseModel): + """ + UserName + """ # noqa: E501 + username: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["username"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'username': 'username', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserName - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - username (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserName from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserName - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - username (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserName from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "username": obj.get("username") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.username: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_name_list.py b/symphony/bdk/gen/pod_model/user_name_list.py deleted file mode 100644 index 4386fe8d..00000000 --- a/symphony/bdk/gen/pod_model/user_name_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.user_name import UserName -globals()['UserName'] = UserName - -class UserNameList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([UserName],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """UserNameList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([UserName]): # noqa: E501 - - Keyword Args: - value ([UserName]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[UserName] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """UserNameList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([UserName]): # noqa: E501 - - Keyword Args: - value ([UserName]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/user_search_filter.py b/symphony/bdk/gen/pod_model/user_search_filter.py index 39543a06..56111365 100644 --- a/symphony/bdk/gen/pod_model/user_search_filter.py +++ b/symphony/bdk/gen/pod_model/user_search_filter.py @@ -1,294 +1,101 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.string_list import StringList -globals()['StringList'] = StringList - -class UserSearchFilter(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'account_types': (StringList, none_type), # noqa: E501 - 'title': (str, none_type), # noqa: E501 - 'company': (str, none_type), # noqa: E501 - 'location': (str, none_type), # noqa: E501 - 'market_coverage': (str, none_type), # noqa: E501 - 'responsibility': (str, none_type), # noqa: E501 - 'function': (str, none_type), # noqa: E501 - 'instrument': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'account_types': 'accountTypes', # noqa: E501 - 'title': 'title', # noqa: E501 - 'company': 'company', # noqa: E501 - 'location': 'location', # noqa: E501 - 'market_coverage': 'marketCoverage', # noqa: E501 - 'responsibility': 'responsibility', # noqa: E501 - 'function': 'function', # noqa: E501 - 'instrument': 'instrument', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class UserSearchFilter(BaseModel): + """ + UserSearchFilter + """ # noqa: E501 + account_types: Optional[List[StrictStr]] = Field(default=None, alias="accountTypes") + title: Optional[StrictStr] = Field(default=None, description="user's job title") + company: Optional[StrictStr] = Field(default=None, description="company name") + location: Optional[StrictStr] = Field(default=None, description="city of the user's job location") + market_coverage: Optional[StrictStr] = Field(default=None, description="geographic area the user works with", alias="marketCoverage") + responsibility: Optional[StrictStr] = Field(default=None, description="user's responsibility") + function: Optional[StrictStr] = Field(default=None, description="user's function") + instrument: Optional[StrictStr] = Field(default=None, description="higher level instrument for the Asset Classes") + __properties: ClassVar[List[str]] = ["accountTypes", "title", "company", "location", "marketCoverage", "responsibility", "function", "instrument"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserSearchFilter - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserSearchFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - account_types (StringList): [optional] # noqa: E501 - title (str): user's job title. [optional] # noqa: E501 - company (str): company name. [optional] # noqa: E501 - location (str): city of the user's job location. [optional] # noqa: E501 - market_coverage (str): geographic area the user works with. [optional] # noqa: E501 - responsibility (str): user's responsibility. [optional] # noqa: E501 - function (str): user's function. [optional] # noqa: E501 - instrument (str): higher level instrument for the Asset Classes. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserSearchFilter - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - account_types (StringList): [optional] # noqa: E501 - title (str): user's job title. [optional] # noqa: E501 - company (str): company name. [optional] # noqa: E501 - location (str): city of the user's job location. [optional] # noqa: E501 - market_coverage (str): geographic area the user works with. [optional] # noqa: E501 - responsibility (str): user's responsibility. [optional] # noqa: E501 - function (str): user's function. [optional] # noqa: E501 - instrument (str): higher level instrument for the Asset Classes. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserSearchFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "accountTypes": obj.get("accountTypes"), + "title": obj.get("title"), + "company": obj.get("company"), + "location": obj.get("location"), + "marketCoverage": obj.get("marketCoverage"), + "responsibility": obj.get("responsibility"), + "function": obj.get("function"), + "instrument": obj.get("instrument") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.account_types: StringList = None - self.title: str = None - self.company: str = None - self.location: str = None - self.market_coverage: str = None - self.responsibility: str = None - self.function: str = None - self.instrument: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_search_query.py b/symphony/bdk/gen/pod_model/user_search_query.py index 8ac91add..0c6980e6 100644 --- a/symphony/bdk/gen/pod_model/user_search_query.py +++ b/symphony/bdk/gen/pod_model/user_search_query.py @@ -1,264 +1,93 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.user_search_filter import UserSearchFilter -globals()['UserSearchFilter'] = UserSearchFilter +from typing import Optional, Set +from typing_extensions import Self -class UserSearchQuery(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserSearchQuery(BaseModel): """ + UserSearchQuery + """ # noqa: E501 + query: Optional[StrictStr] = Field(default=None, description="search / query term. This can be firstname, lastname, displayname or email") + filters: Optional[UserSearchFilter] = None + __properties: ClassVar[List[str]] = ["query", "filters"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'query': (str, none_type), # noqa: E501 - 'filters': (UserSearchFilter, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'query': 'query', # noqa: E501 - 'filters': 'filters', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserSearchQuery - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - query (str): search / query term. This can be firstname, lastname, displayname or email. [optional] # noqa: E501 - filters (UserSearchFilter): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserSearchQuery from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserSearchQuery - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - query (str): search / query term. This can be firstname, lastname, displayname or email. [optional] # noqa: E501 - filters (UserSearchFilter): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserSearchQuery from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "query": obj.get("query"), + "filters": UserSearchFilter.from_dict(obj["filters"]) if obj.get("filters") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.query: str = None - self.filters: UserSearchFilter = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_search_results.py b/symphony/bdk/gen/pod_model/user_search_results.py index 6c65d157..56262168 100644 --- a/symphony/bdk/gen/pod_model/user_search_results.py +++ b/symphony/bdk/gen/pod_model/user_search_results.py @@ -1,281 +1,107 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.user_search_query import UserSearchQuery from symphony.bdk.gen.pod_model.user_v2 import UserV2 -globals()['UserSearchQuery'] = UserSearchQuery -globals()['UserV2'] = UserV2 - -class UserSearchResults(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserSearchResults(BaseModel): """ + UserSearchResults + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="The total number of users which matched the search criteria.") + skip: Optional[StrictInt] = Field(default=None, description="The number of skipped results.") + limit: Optional[StrictInt] = Field(default=None, description="The number of returned results.") + search_query: Optional[UserSearchQuery] = Field(default=None, alias="searchQuery") + users: Optional[List[UserV2]] = Field(default=None, description="A list of users which matched by the search criteria.") + __properties: ClassVar[List[str]] = ["count", "skip", "limit", "searchQuery", "users"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserSearchResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'count': (int, none_type), # noqa: E501 - 'skip': (int, none_type), # noqa: E501 - 'limit': (int, none_type), # noqa: E501 - 'search_query': (UserSearchQuery, none_type), # noqa: E501 - 'users': ([UserV2], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'count': 'count', # noqa: E501 - 'skip': 'skip', # noqa: E501 - 'limit': 'limit', # noqa: E501 - 'search_query': 'searchQuery', # noqa: E501 - 'users': 'users', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of search_query + if self.search_query: + _dict['searchQuery'] = self.search_query.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in users (list) + _items = [] + if self.users: + for _item_users in self.users: + if _item_users: + _items.append(_item_users.to_dict()) + _dict['users'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserSearchResults - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): The total number of users which matched the search criteria.. [optional] # noqa: E501 - skip (int): The number of skipped results.. [optional] # noqa: E501 - limit (int): The number of returned results.. [optional] # noqa: E501 - search_query (UserSearchQuery): [optional] # noqa: E501 - users ([UserV2]): A list of users which matched by the search criteria.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserSearchResults - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): The total number of users which matched the search criteria.. [optional] # noqa: E501 - skip (int): The number of skipped results.. [optional] # noqa: E501 - limit (int): The number of returned results.. [optional] # noqa: E501 - search_query (UserSearchQuery): [optional] # noqa: E501 - users ([UserV2]): A list of users which matched by the search criteria.. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserSearchResults from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "count": obj.get("count"), + "skip": obj.get("skip"), + "limit": obj.get("limit"), + "searchQuery": UserSearchQuery.from_dict(obj["searchQuery"]) if obj.get("searchQuery") is not None else None, + "users": [UserV2.from_dict(_item) for _item in obj["users"]] if obj.get("users") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.count: int = None - self.skip: int = None - self.limit: int = None - self.search_query: UserSearchQuery = None - self.users: List[UserV2] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_status.py b/symphony/bdk/gen/pod_model/user_status.py index 20d82426..8b97c70c 100644 --- a/symphony/bdk/gen/pod_model/user_status.py +++ b/symphony/bdk/gen/pod_model/user_status.py @@ -1,275 +1,103 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Generated by OpenAPI Generator (https://openapi-generator.tech) -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Do not edit the class manually. +""" # noqa: E501 -class UserStatus(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class UserStatus(BaseModel): """ + UserStatus + """ # noqa: E501 + status: Optional[StrictStr] = None + suspended: Optional[StrictBool] = Field(default=None, description="An optional attribute indicating whether the user is temporarily suspended or not. Since SBE 20.14.") + suspended_until: Optional[StrictInt] = Field(default=None, description="An optional unix timestamp until which the suspension is effective. Since SBE 20.14.", alias="suspendedUntil") + suspension_reason: Optional[StrictStr] = Field(default=None, description="An optional description of the suspension reason. Since SBE 20.14.", alias="suspensionReason") + __properties: ClassVar[List[str]] = ["status", "suspended", "suspendedUntil", "suspensionReason"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ENABLED', 'DISABLED']): + raise ValueError("must be one of enum values ('ENABLED', 'DISABLED')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - ('status',): { - 'ENABLED': "ENABLED", - 'DISABLED': "DISABLED", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'status': (str, none_type), # noqa: E501 - 'suspended': (bool, none_type), # noqa: E501 - 'suspended_until': (int, none_type), # noqa: E501 - 'suspension_reason': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None + excluded_fields: Set[str] = set([ + ]) - - attribute_map = { - 'status': 'status', # noqa: E501 - 'suspended': 'suspended', # noqa: E501 - 'suspended_until': 'suspendedUntil', # noqa: E501 - 'suspension_reason': 'suspensionReason', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserStatus - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - status (str): [optional] # noqa: E501 - suspended (bool): An optional attribute indicating whether the user is temporarily suspended or not. Since SBE 20.14.. [optional] # noqa: E501 - suspended_until (int): An optional unix timestamp until which the suspension is effective. Since SBE 20.14.. [optional] # noqa: E501 - suspension_reason (str): An optional description of the suspension reason. Since SBE 20.14.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserStatus - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - status (str): [optional] # noqa: E501 - suspended (bool): An optional attribute indicating whether the user is temporarily suspended or not. Since SBE 20.14.. [optional] # noqa: E501 - suspended_until (int): An optional unix timestamp until which the suspension is effective. Since SBE 20.14.. [optional] # noqa: E501 - suspension_reason (str): An optional description of the suspension reason. Since SBE 20.14.. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserStatus from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "status": obj.get("status"), + "suspended": obj.get("suspended"), + "suspendedUntil": obj.get("suspendedUntil"), + "suspensionReason": obj.get("suspensionReason") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.status: str = None - self.suspended: bool = None - self.suspended_until: int = None - self.suspension_reason: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_suspension.py b/symphony/bdk/gen/pod_model/user_suspension.py index 256370b0..f22191c0 100644 --- a/symphony/bdk/gen/pod_model/user_suspension.py +++ b/symphony/bdk/gen/pod_model/user_suspension.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserSuspension(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'suspended': (bool, none_type), # noqa: E501 - 'suspended_until': (int, none_type), # noqa: E501 - 'suspension_reason': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class UserSuspension(BaseModel): + """ + UserSuspension + """ # noqa: E501 + suspended: Optional[StrictBool] = None + suspended_until: Optional[StrictInt] = Field(default=None, alias="suspendedUntil") + suspension_reason: Optional[StrictStr] = Field(default=None, alias="suspensionReason") + __properties: ClassVar[List[str]] = ["suspended", "suspendedUntil", "suspensionReason"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'suspended': 'suspended', # noqa: E501 - 'suspended_until': 'suspendedUntil', # noqa: E501 - 'suspension_reason': 'suspensionReason', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserSuspension - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - suspended (bool): [optional] # noqa: E501 - suspended_until (int): [optional] # noqa: E501 - suspension_reason (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserSuspension from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserSuspension - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - suspended (bool): [optional] # noqa: E501 - suspended_until (int): [optional] # noqa: E501 - suspension_reason (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserSuspension from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "suspended": obj.get("suspended"), + "suspendedUntil": obj.get("suspendedUntil"), + "suspensionReason": obj.get("suspensionReason") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.suspended: bool = None - self.suspended_until: int = None - self.suspension_reason: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_system_info.py b/symphony/bdk/gen/pod_model/user_system_info.py index 7997de39..7d141f89 100644 --- a/symphony/bdk/gen/pod_model/user_system_info.py +++ b/symphony/bdk/gen/pod_model/user_system_info.py @@ -1,310 +1,117 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class UserSystemInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('status',): { - 'ENABLED': "ENABLED", - 'DISABLED': "DISABLED", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (int, none_type), # noqa: E501 - 'status': (str, none_type), # noqa: E501 - 'suspended': (bool, none_type), # noqa: E501 - 'suspended_until': (int, none_type), # noqa: E501 - 'suspension_reason': (str, none_type), # noqa: E501 - 'created_date': (int, none_type), # noqa: E501 - 'created_by': (str, none_type), # noqa: E501 - 'last_updated_date': (int, none_type), # noqa: E501 - 'last_login_date': (int, none_type), # noqa: E501 - 'last_password_reset': (int, none_type), # noqa: E501 - 'deactivated_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'status': 'status', # noqa: E501 - 'suspended': 'suspended', # noqa: E501 - 'suspended_until': 'suspendedUntil', # noqa: E501 - 'suspension_reason': 'suspensionReason', # noqa: E501 - 'created_date': 'createdDate', # noqa: E501 - 'created_by': 'createdBy', # noqa: E501 - 'last_updated_date': 'lastUpdatedDate', # noqa: E501 - 'last_login_date': 'lastLoginDate', # noqa: E501 - 'last_password_reset': 'lastPasswordReset', # noqa: E501 - 'deactivated_date': 'deactivatedDate', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class UserSystemInfo(BaseModel): + """ + User Status Information. + """ # noqa: E501 + id: Optional[StrictInt] = None + status: Optional[StrictStr] = None + suspended: Optional[StrictBool] = Field(default=None, description="An optional attribute indicating whether the user is temporarily suspended or not. Since SBE 20.14.") + suspended_until: Optional[StrictInt] = Field(default=None, description="An optional unix timestamp until which the suspension is effective. Since SBE 20.14.", alias="suspendedUntil") + suspension_reason: Optional[StrictStr] = Field(default=None, description="An optional description of the suspension reason. Since SBE 20.14.", alias="suspensionReason") + created_date: Optional[StrictInt] = Field(default=None, alias="createdDate") + created_by: Optional[StrictStr] = Field(default=None, alias="createdBy") + last_updated_date: Optional[StrictInt] = Field(default=None, alias="lastUpdatedDate") + last_login_date: Optional[StrictInt] = Field(default=None, alias="lastLoginDate") + last_password_reset: Optional[StrictInt] = Field(default=None, alias="lastPasswordReset") + deactivated_date: Optional[StrictInt] = Field(default=None, alias="deactivatedDate") + __properties: ClassVar[List[str]] = ["id", "status", "suspended", "suspendedUntil", "suspensionReason", "createdDate", "createdBy", "lastUpdatedDate", "lastLoginDate", "lastPasswordReset", "deactivatedDate"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['ENABLED', 'DISABLED']): + raise ValueError("must be one of enum values ('ENABLED', 'DISABLED')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserSystemInfo - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserSystemInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - status (str): [optional] # noqa: E501 - suspended (bool): An optional attribute indicating whether the user is temporarily suspended or not. Since SBE 20.14.. [optional] # noqa: E501 - suspended_until (int): An optional unix timestamp until which the suspension is effective. Since SBE 20.14.. [optional] # noqa: E501 - suspension_reason (str): An optional description of the suspension reason. Since SBE 20.14.. [optional] # noqa: E501 - created_date (int): [optional] # noqa: E501 - created_by (str): [optional] # noqa: E501 - last_updated_date (int): [optional] # noqa: E501 - last_login_date (int): [optional] # noqa: E501 - last_password_reset (int): [optional] # noqa: E501 - deactivated_date (int): [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserSystemInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - status (str): [optional] # noqa: E501 - suspended (bool): An optional attribute indicating whether the user is temporarily suspended or not. Since SBE 20.14.. [optional] # noqa: E501 - suspended_until (int): An optional unix timestamp until which the suspension is effective. Since SBE 20.14.. [optional] # noqa: E501 - suspension_reason (str): An optional description of the suspension reason. Since SBE 20.14.. [optional] # noqa: E501 - created_date (int): [optional] # noqa: E501 - created_by (str): [optional] # noqa: E501 - last_updated_date (int): [optional] # noqa: E501 - last_login_date (int): [optional] # noqa: E501 - last_password_reset (int): [optional] # noqa: E501 - deactivated_date (int): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserSystemInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "suspended": obj.get("suspended"), + "suspendedUntil": obj.get("suspendedUntil"), + "suspensionReason": obj.get("suspensionReason"), + "createdDate": obj.get("createdDate"), + "createdBy": obj.get("createdBy"), + "lastUpdatedDate": obj.get("lastUpdatedDate"), + "lastLoginDate": obj.get("lastLoginDate"), + "lastPasswordReset": obj.get("lastPasswordReset"), + "deactivatedDate": obj.get("deactivatedDate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: int = None - self.status: str = None - self.suspended: bool = None - self.suspended_until: int = None - self.suspension_reason: str = None - self.created_date: int = None - self.created_by: str = None - self.last_updated_date: int = None - self.last_login_date: int = None - self.last_password_reset: int = None - self.deactivated_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/user_v2.py b/symphony/bdk/gen/pod_model/user_v2.py index 5163ba36..dd383a5c 100644 --- a/symphony/bdk/gen/pod_model/user_v2.py +++ b/symphony/bdk/gen/pod_model/user_v2.py @@ -1,346 +1,137 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.avatar_list import AvatarList -from symphony.bdk.gen.pod_model.string_list import StringList -globals()['AvatarList'] = AvatarList -globals()['StringList'] = StringList - -class UserV2(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('account_type',): { - 'NORMAL': "NORMAL", - 'SYSTEM': "SYSTEM", - 'SDL': "SDL", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (int, none_type), # noqa: E501 - 'email_address': (str, none_type), # noqa: E501 - 'first_name': (str, none_type), # noqa: E501 - 'last_name': (str, none_type), # noqa: E501 - 'display_name': (str, none_type), # noqa: E501 - 'title': (str, none_type), # noqa: E501 - 'company': (str, none_type), # noqa: E501 - 'username': (str, none_type), # noqa: E501 - 'location': (str, none_type), # noqa: E501 - 'account_type': (str, none_type), # noqa: E501 - 'avatars': (AvatarList, none_type), # noqa: E501 - 'work_phone_number': (str, none_type), # noqa: E501 - 'mobile_phone_number': (str, none_type), # noqa: E501 - 'job_function': (str, none_type), # noqa: E501 - 'department': (str, none_type), # noqa: E501 - 'division': (str, none_type), # noqa: E501 - 'roles': (StringList, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'email_address': 'emailAddress', # noqa: E501 - 'first_name': 'firstName', # noqa: E501 - 'last_name': 'lastName', # noqa: E501 - 'display_name': 'displayName', # noqa: E501 - 'title': 'title', # noqa: E501 - 'company': 'company', # noqa: E501 - 'username': 'username', # noqa: E501 - 'location': 'location', # noqa: E501 - 'account_type': 'accountType', # noqa: E501 - 'avatars': 'avatars', # noqa: E501 - 'work_phone_number': 'workPhoneNumber', # noqa: E501 - 'mobile_phone_number': 'mobilePhoneNumber', # noqa: E501 - 'job_function': 'jobFunction', # noqa: E501 - 'department': 'department', # noqa: E501 - 'division': 'division', # noqa: E501 - 'roles': 'roles', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from symphony.bdk.gen.pod_model.avatar import Avatar +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class UserV2(BaseModel): + """ + User record version 2 + """ # noqa: E501 + id: Optional[StrictInt] = None + email_address: Optional[StrictStr] = Field(default=None, alias="emailAddress") + first_name: Optional[StrictStr] = Field(default=None, alias="firstName") + last_name: Optional[StrictStr] = Field(default=None, alias="lastName") + display_name: Optional[StrictStr] = Field(default=None, alias="displayName") + title: Optional[StrictStr] = None + company: Optional[StrictStr] = None + username: Optional[StrictStr] = None + location: Optional[StrictStr] = None + account_type: Optional[StrictStr] = Field(default=None, alias="accountType") + avatars: Optional[List[Avatar]] = None + work_phone_number: Optional[StrictStr] = Field(default=None, description="Note: only available if the application has the extended user or contact permission", alias="workPhoneNumber") + mobile_phone_number: Optional[StrictStr] = Field(default=None, description="Note: only available if the application has the extended user or contact permission", alias="mobilePhoneNumber") + job_function: Optional[StrictStr] = Field(default=None, description="Note: only available if the application has the extended user or contact permission", alias="jobFunction") + department: Optional[StrictStr] = Field(default=None, description="Note: only available if the application has the extended user or contact permission") + division: Optional[StrictStr] = Field(default=None, description="Note: only available if the application has the extended user or contact permission") + roles: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["id", "emailAddress", "firstName", "lastName", "displayName", "title", "company", "username", "location", "accountType", "avatars", "workPhoneNumber", "mobilePhoneNumber", "jobFunction", "department", "division", "roles"] + + @field_validator('account_type') + def account_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['NORMAL', 'SYSTEM', 'SDL']): + raise ValueError("must be one of enum values ('NORMAL', 'SYSTEM', 'SDL')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """UserV2 - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - email_address (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - display_name (str): [optional] # noqa: E501 - title (str): [optional] # noqa: E501 - company (str): [optional] # noqa: E501 - username (str): [optional] # noqa: E501 - location (str): [optional] # noqa: E501 - account_type (str): [optional] # noqa: E501 - avatars (AvatarList): [optional] # noqa: E501 - work_phone_number (str): Note: only available if the application has the extended user or contact permission. [optional] # noqa: E501 - mobile_phone_number (str): Note: only available if the application has the extended user or contact permission. [optional] # noqa: E501 - job_function (str): Note: only available if the application has the extended user or contact permission. [optional] # noqa: E501 - department (str): Note: only available if the application has the extended user or contact permission. [optional] # noqa: E501 - division (str): Note: only available if the application has the extended user or contact permission. [optional] # noqa: E501 - roles (StringList): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserV2 from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """UserV2 - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (int): [optional] # noqa: E501 - email_address (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - display_name (str): [optional] # noqa: E501 - title (str): [optional] # noqa: E501 - company (str): [optional] # noqa: E501 - username (str): [optional] # noqa: E501 - location (str): [optional] # noqa: E501 - account_type (str): [optional] # noqa: E501 - avatars (AvatarList): [optional] # noqa: E501 - work_phone_number (str): Note: only available if the application has the extended user or contact permission. [optional] # noqa: E501 - mobile_phone_number (str): Note: only available if the application has the extended user or contact permission. [optional] # noqa: E501 - job_function (str): Note: only available if the application has the extended user or contact permission. [optional] # noqa: E501 - department (str): Note: only available if the application has the extended user or contact permission. [optional] # noqa: E501 - division (str): Note: only available if the application has the extended user or contact permission. [optional] # noqa: E501 - roles (StringList): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in avatars (list) + _items = [] + if self.avatars: + for _item_avatars in self.avatars: + if _item_avatars: + _items.append(_item_avatars.to_dict()) + _dict['avatars'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserV2 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "emailAddress": obj.get("emailAddress"), + "firstName": obj.get("firstName"), + "lastName": obj.get("lastName"), + "displayName": obj.get("displayName"), + "title": obj.get("title"), + "company": obj.get("company"), + "username": obj.get("username"), + "location": obj.get("location"), + "accountType": obj.get("accountType"), + "avatars": [Avatar.from_dict(_item) for _item in obj["avatars"]] if obj.get("avatars") is not None else None, + "workPhoneNumber": obj.get("workPhoneNumber"), + "mobilePhoneNumber": obj.get("mobilePhoneNumber"), + "jobFunction": obj.get("jobFunction"), + "department": obj.get("department"), + "division": obj.get("division"), + "roles": obj.get("roles") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: int = None - self.email_address: str = None - self.first_name: str = None - self.last_name: str = None - self.display_name: str = None - self.title: str = None - self.company: str = None - self.username: str = None - self.location: str = None - self.account_type: str = None - self.avatars: AvatarList = None - self.work_phone_number: str = None - self.mobile_phone_number: str = None - self.job_function: str = None - self.department: str = None - self.division: str = None - self.roles: StringList = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v1_im_attributes.py b/symphony/bdk/gen/pod_model/v1_im_attributes.py index b3ff94a9..68ed0072 100644 --- a/symphony/bdk/gen/pod_model/v1_im_attributes.py +++ b/symphony/bdk/gen/pod_model/v1_im_attributes.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V1IMAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'pinned_message_id': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V1IMAttributes(BaseModel): + """ + V1IMAttributes + """ # noqa: E501 + pinned_message_id: Optional[StrictStr] = Field(default=None, description="UrlSafe message id of the pinned message inside the IM. To perform unpin operation, send an empty string.", alias="pinnedMessageId") + __properties: ClassVar[List[str]] = ["pinnedMessageId"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'pinned_message_id': 'pinnedMessageId', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1IMAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pinned_message_id (str): UrlSafe message id of the pinned message inside the IM. To perform unpin operation, send an empty string.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1IMAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1IMAttributes - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - pinned_message_id (str): UrlSafe message id of the pinned message inside the IM. To perform unpin operation, send an empty string.. [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1IMAttributes from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "pinnedMessageId": obj.get("pinnedMessageId") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.pinned_message_id: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v1_im_detail.py b/symphony/bdk/gen/pod_model/v1_im_detail.py index 2e8a9b8f..7f5b3d03 100644 --- a/symphony/bdk/gen/pod_model/v1_im_detail.py +++ b/symphony/bdk/gen/pod_model/v1_im_detail.py @@ -1,266 +1,97 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.im_system_info import IMSystemInfo from symphony.bdk.gen.pod_model.v1_im_attributes import V1IMAttributes -globals()['IMSystemInfo'] = IMSystemInfo -globals()['V1IMAttributes'] = V1IMAttributes +from typing import Optional, Set +from typing_extensions import Self -class V1IMDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1IMDetail(BaseModel): """ + V1IMDetail + """ # noqa: E501 + v1_im_attributes: Optional[V1IMAttributes] = Field(default=None, alias="V1IMAttributes") + im_system_info: Optional[IMSystemInfo] = Field(default=None, alias="IMSystemInfo") + __properties: ClassVar[List[str]] = ["V1IMAttributes", "IMSystemInfo"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'v1_im_attributes': (V1IMAttributes, none_type), # noqa: E501 - 'im_system_info': (IMSystemInfo, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'v1_im_attributes': 'V1IMAttributes', # noqa: E501 - 'im_system_info': 'IMSystemInfo', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1IMDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - v1_im_attributes (V1IMAttributes): [optional] # noqa: E501 - im_system_info (IMSystemInfo): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1IMDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1IMDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - v1_im_attributes (V1IMAttributes): [optional] # noqa: E501 - im_system_info (IMSystemInfo): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of v1_im_attributes + if self.v1_im_attributes: + _dict['V1IMAttributes'] = self.v1_im_attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of im_system_info + if self.im_system_info: + _dict['IMSystemInfo'] = self.im_system_info.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1IMDetail from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "V1IMAttributes": V1IMAttributes.from_dict(obj["V1IMAttributes"]) if obj.get("V1IMAttributes") is not None else None, + "IMSystemInfo": IMSystemInfo.from_dict(obj["IMSystemInfo"]) if obj.get("IMSystemInfo") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.v1_im_attributes: V1IMAttributes = None - self.im_system_info: IMSystemInfo = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v1_session.py b/symphony/bdk/gen/pod_model/v1_session.py index d355b3b3..4de61659 100644 --- a/symphony/bdk/gen/pod_model/v1_session.py +++ b/symphony/bdk/gen/pod_model/v1_session.py @@ -1,301 +1,105 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V1Session(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'session_id': (str, none_type), # noqa: E501 - 'client_ip': (str, none_type), # noqa: E501 - 'user_id': (int, none_type), # noqa: E501 - 'user_agent': (str, none_type), # noqa: E501 - 'browser': (str, none_type), # noqa: E501 - 'os': (str, none_type), # noqa: E501 - 'device': (str, none_type), # noqa: E501 - 'device_hash': (str, none_type), # noqa: E501 - 'creation_time': (int, none_type), # noqa: E501 - 'expiration_delay': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'session_id': 'sessionId', # noqa: E501 - 'client_ip': 'clientIp', # noqa: E501 - 'user_id': 'userId', # noqa: E501 - 'user_agent': 'userAgent', # noqa: E501 - 'browser': 'browser', # noqa: E501 - 'os': 'os', # noqa: E501 - 'device': 'device', # noqa: E501 - 'device_hash': 'deviceHash', # noqa: E501 - 'creation_time': 'creationTime', # noqa: E501 - 'expiration_delay': 'expirationDelay', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class V1Session(BaseModel): + """ + V1 Detailed Session record. + """ # noqa: E501 + session_id: Optional[StrictStr] = Field(default=None, description="The id of the user session", alias="sessionId") + client_ip: Optional[StrictStr] = Field(default=None, description="The ip address of the session initiator", alias="clientIp") + user_id: Optional[StrictInt] = Field(default=None, description="The user id of the session initiator", alias="userId") + user_agent: Optional[StrictStr] = Field(default=None, description="The user agent of the session", alias="userAgent") + browser: Optional[StrictStr] = Field(default=None, description="The browser section of the user agent") + os: Optional[StrictStr] = Field(default=None, description="The os section of the user agent") + device: Optional[StrictStr] = Field(default=None, description="The device section of the user agent") + device_hash: Optional[StrictStr] = Field(default=None, description="A hash uniquely identifying the device of the requester", alias="deviceHash") + creation_time: Optional[StrictInt] = Field(default=None, description="The timestamp of the creation time the user session", alias="creationTime") + expiration_delay: Optional[StrictInt] = Field(default=None, description="The timestamp of the expiry time of the user session", alias="expirationDelay") + __properties: ClassVar[List[str]] = ["sessionId", "clientIp", "userId", "userAgent", "browser", "os", "device", "deviceHash", "creationTime", "expirationDelay"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1Session - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1Session from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - session_id (str): The id of the user session. [optional] # noqa: E501 - client_ip (str): The ip address of the session initiator. [optional] # noqa: E501 - user_id (int): The user id of the session initiator. [optional] # noqa: E501 - user_agent (str): The user agent of the session. [optional] # noqa: E501 - browser (str): The browser section of the user agent. [optional] # noqa: E501 - os (str): The os section of the user agent. [optional] # noqa: E501 - device (str): The device section of the user agent. [optional] # noqa: E501 - device_hash (str): A hash uniquely identifying the device of the requester. [optional] # noqa: E501 - creation_time (int): The timestamp of the creation time the user session. [optional] # noqa: E501 - expiration_delay (int): The timestamp of the expiry time of the user session. [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1Session - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - session_id (str): The id of the user session. [optional] # noqa: E501 - client_ip (str): The ip address of the session initiator. [optional] # noqa: E501 - user_id (int): The user id of the session initiator. [optional] # noqa: E501 - user_agent (str): The user agent of the session. [optional] # noqa: E501 - browser (str): The browser section of the user agent. [optional] # noqa: E501 - os (str): The os section of the user agent. [optional] # noqa: E501 - device (str): The device section of the user agent. [optional] # noqa: E501 - device_hash (str): A hash uniquely identifying the device of the requester. [optional] # noqa: E501 - creation_time (int): The timestamp of the creation time the user session. [optional] # noqa: E501 - expiration_delay (int): The timestamp of the expiry time of the user session. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1Session from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "sessionId": obj.get("sessionId"), + "clientIp": obj.get("clientIp"), + "userId": obj.get("userId"), + "userAgent": obj.get("userAgent"), + "browser": obj.get("browser"), + "os": obj.get("os"), + "device": obj.get("device"), + "deviceHash": obj.get("deviceHash"), + "creationTime": obj.get("creationTime"), + "expirationDelay": obj.get("expirationDelay") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.session_id: str = None - self.client_ip: str = None - self.user_id: int = None - self.user_agent: str = None - self.browser: str = None - self.os: str = None - self.device: str = None - self.device_hash: str = None - self.creation_time: int = None - self.expiration_delay: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v1_user_sessions.py b/symphony/bdk/gen/pod_model/v1_user_sessions.py index 70bd9989..a8a12595 100644 --- a/symphony/bdk/gen/pod_model/v1_user_sessions.py +++ b/symphony/bdk/gen/pod_model/v1_user_sessions.py @@ -1,259 +1,95 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.v1_session import V1Session -globals()['V1Session'] = V1Session +from typing import Optional, Set +from typing_extensions import Self -class V1UserSessions(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V1UserSessions(BaseModel): """ + V1 Detailed Sessions Record. + """ # noqa: E501 + sessions: Optional[List[V1Session]] = None + __properties: ClassVar[List[str]] = ["sessions"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'sessions': ([V1Session], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'sessions': 'sessions', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V1UserSessions - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - sessions ([V1Session]): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V1UserSessions from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V1UserSessions - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - sessions ([V1Session]): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in sessions (list) + _items = [] + if self.sessions: + for _item_sessions in self.sessions: + if _item_sessions: + _items.append(_item_sessions.to_dict()) + _dict['sessions'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V1UserSessions from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "sessions": [V1Session.from_dict(_item) for _item in obj["sessions"]] if obj.get("sessions") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.sessions: List[V1Session] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_admin_stream_attributes.py b/symphony/bdk/gen/pod_model/v2_admin_stream_attributes.py index 494067dc..e5d8bc57 100644 --- a/symphony/bdk/gen/pod_model/v2_admin_stream_attributes.py +++ b/symphony/bdk/gen/pod_model/v2_admin_stream_attributes.py @@ -1,306 +1,107 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2AdminStreamAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'room_name': (str, none_type), # noqa: E501 - 'room_description': (str, none_type), # noqa: E501 - 'members': ([int], none_type), # noqa: E501 - 'created_by_user_id': (int, none_type), # noqa: E501 - 'created_date': (int, none_type), # noqa: E501 - 'last_modified_date': (int, none_type), # noqa: E501 - 'origin_company': (str, none_type), # noqa: E501 - 'origin_company_id': (int, none_type), # noqa: E501 - 'members_count': (int, none_type), # noqa: E501 - 'last_message_date': (int, none_type), # noqa: E501 - 'group_chat': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'room_name': 'roomName', # noqa: E501 - 'room_description': 'roomDescription', # noqa: E501 - 'members': 'members', # noqa: E501 - 'created_by_user_id': 'createdByUserId', # noqa: E501 - 'created_date': 'createdDate', # noqa: E501 - 'last_modified_date': 'lastModifiedDate', # noqa: E501 - 'origin_company': 'originCompany', # noqa: E501 - 'origin_company_id': 'originCompanyId', # noqa: E501 - 'members_count': 'membersCount', # noqa: E501 - 'last_message_date': 'lastMessageDate', # noqa: E501 - 'group_chat': 'groupChat', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class V2AdminStreamAttributes(BaseModel): + """ + additional optional properties for the stream + """ # noqa: E501 + room_name: Optional[StrictStr] = Field(default=None, description="room name (room only)", alias="roomName") + room_description: Optional[StrictStr] = Field(default=None, description="description of the room (room only)", alias="roomDescription") + members: Optional[List[StrictInt]] = Field(default=None, description="list of userid who is member of the stream - im or mim only") + created_by_user_id: Optional[StrictInt] = Field(default=None, description="creator user id", alias="createdByUserId") + created_date: Optional[StrictInt] = Field(default=None, description="created date", alias="createdDate") + last_modified_date: Optional[StrictInt] = Field(default=None, description="last modified date", alias="lastModifiedDate") + origin_company: Optional[StrictStr] = Field(default=None, description="company name of the creator", alias="originCompany") + origin_company_id: Optional[StrictInt] = Field(default=None, description="company id of the creator", alias="originCompanyId") + members_count: Optional[StrictInt] = Field(default=None, description="total number of members in the stream", alias="membersCount") + last_message_date: Optional[StrictInt] = Field(default=None, description="last date a message was sent in this stream", alias="lastMessageDate") + group_chat: Optional[StrictBool] = Field(default=None, description="whether a stream is a group chat or not. Since SBE 20.16.", alias="groupChat") + __properties: ClassVar[List[str]] = ["roomName", "roomDescription", "members", "createdByUserId", "createdDate", "lastModifiedDate", "originCompany", "originCompanyId", "membersCount", "lastMessageDate", "groupChat"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2AdminStreamAttributes - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2AdminStreamAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - room_name (str): room name (room only). [optional] # noqa: E501 - room_description (str): description of the room (room only). [optional] # noqa: E501 - members ([int]): list of userid who is member of the stream - im or mim only. [optional] # noqa: E501 - created_by_user_id (int): creator user id. [optional] # noqa: E501 - created_date (int): created date. [optional] # noqa: E501 - last_modified_date (int): last modified date. [optional] # noqa: E501 - origin_company (str): company name of the creator. [optional] # noqa: E501 - origin_company_id (int): company id of the creator. [optional] # noqa: E501 - members_count (int): total number of members in the stream. [optional] # noqa: E501 - last_message_date (int): last date a message was sent in this stream. [optional] # noqa: E501 - group_chat (bool): whether a stream is a group chat or not. Since SBE 20.16.. [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2AdminStreamAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - room_name (str): room name (room only). [optional] # noqa: E501 - room_description (str): description of the room (room only). [optional] # noqa: E501 - members ([int]): list of userid who is member of the stream - im or mim only. [optional] # noqa: E501 - created_by_user_id (int): creator user id. [optional] # noqa: E501 - created_date (int): created date. [optional] # noqa: E501 - last_modified_date (int): last modified date. [optional] # noqa: E501 - origin_company (str): company name of the creator. [optional] # noqa: E501 - origin_company_id (int): company id of the creator. [optional] # noqa: E501 - members_count (int): total number of members in the stream. [optional] # noqa: E501 - last_message_date (int): last date a message was sent in this stream. [optional] # noqa: E501 - group_chat (bool): whether a stream is a group chat or not. Since SBE 20.16.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2AdminStreamAttributes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "roomName": obj.get("roomName"), + "roomDescription": obj.get("roomDescription"), + "members": obj.get("members"), + "createdByUserId": obj.get("createdByUserId"), + "createdDate": obj.get("createdDate"), + "lastModifiedDate": obj.get("lastModifiedDate"), + "originCompany": obj.get("originCompany"), + "originCompanyId": obj.get("originCompanyId"), + "membersCount": obj.get("membersCount"), + "lastMessageDate": obj.get("lastMessageDate"), + "groupChat": obj.get("groupChat") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.room_name: str = None - self.room_description: str = None - self.members: List[int] = None - self.created_by_user_id: int = None - self.created_date: int = None - self.last_modified_date: int = None - self.origin_company: str = None - self.origin_company_id: int = None - self.members_count: int = None - self.last_message_date: int = None - self.group_chat: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_admin_stream_filter.py b/symphony/bdk/gen/pod_model/v2_admin_stream_filter.py index 028ba93f..57dde1ca 100644 --- a/symphony/bdk/gen/pod_model/v2_admin_stream_filter.py +++ b/symphony/bdk/gen/pod_model/v2_admin_stream_filter.py @@ -1,289 +1,107 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.v2_admin_stream_type import V2AdminStreamType -globals()['V2AdminStreamType'] = V2AdminStreamType - -class V2AdminStreamFilter(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2AdminStreamFilter(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'stream_types': ([V2AdminStreamType], none_type), # noqa: E501 - 'scope': (str, none_type), # noqa: E501 - 'origin': (str, none_type), # noqa: E501 - 'status': (str, none_type), # noqa: E501 - 'privacy': (str, none_type), # noqa: E501 - 'start_date': (int, none_type), # noqa: E501 - 'end_date': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'stream_types': 'streamTypes', # noqa: E501 - 'scope': 'scope', # noqa: E501 - 'origin': 'origin', # noqa: E501 - 'status': 'status', # noqa: E501 - 'privacy': 'privacy', # noqa: E501 - 'start_date': 'startDate', # noqa: E501 - 'end_date': 'endDate', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + stream filter criteria + """ # noqa: E501 + stream_types: Optional[List[V2AdminStreamType]] = Field(default=None, description="type of streams to search for", alias="streamTypes") + scope: Optional[StrictStr] = Field(default=None, description="Scope of the room. Valid values are INTERNAL or EXTERNAL. If not specified, it will include both Internal and External scope ") + origin: Optional[StrictStr] = Field(default=None, description="Origin of the room. It indicates whether the room was created by a user within the company by another company. Valid values are INTERNAL or EXTERNAL. If not specified, it will include both Internal and External origin ") + status: Optional[StrictStr] = Field(default=None, description="Status of the room. Valid values are ACTIVE or INACTIVE. If not specified, it will include both Active and Inactive status ") + privacy: Optional[StrictStr] = Field(default=None, description="Privacy setting of the stream. Valid values are PUBLIC or PRIVATE. If not specified, it will include both public and private streams ") + start_date: Optional[StrictInt] = Field(default=None, description="Start date in unix timestamp in millseconds", alias="startDate") + end_date: Optional[StrictInt] = Field(default=None, description="End date in unix timestamp in millseconds. If not specified, it assume to be current time.", alias="endDate") + __properties: ClassVar[List[str]] = ["streamTypes", "scope", "origin", "status", "privacy", "startDate", "endDate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2AdminStreamFilter - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream_types ([V2AdminStreamType]): type of streams to search for. [optional] # noqa: E501 - scope (str): Scope of the room. Valid values are INTERNAL or EXTERNAL. If not specified, it will include both Internal and External scope . [optional] # noqa: E501 - origin (str): Origin of the room. It indicates whether the room was created by a user within the company by another company. Valid values are INTERNAL or EXTERNAL. If not specified, it will include both Internal and External origin . [optional] # noqa: E501 - status (str): Status of the room. Valid values are ACTIVE or INACTIVE. If not specified, it will include both Active and Inactive status . [optional] # noqa: E501 - privacy (str): Privacy setting of the stream. Valid values are PUBLIC or PRIVATE. If not specified, it will include both public and private streams . [optional] # noqa: E501 - start_date (int): Start date in unix timestamp in millseconds. [optional] # noqa: E501 - end_date (int): End date in unix timestamp in millseconds. If not specified, it assume to be current time.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2AdminStreamFilter from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2AdminStreamFilter - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - stream_types ([V2AdminStreamType]): type of streams to search for. [optional] # noqa: E501 - scope (str): Scope of the room. Valid values are INTERNAL or EXTERNAL. If not specified, it will include both Internal and External scope . [optional] # noqa: E501 - origin (str): Origin of the room. It indicates whether the room was created by a user within the company by another company. Valid values are INTERNAL or EXTERNAL. If not specified, it will include both Internal and External origin . [optional] # noqa: E501 - status (str): Status of the room. Valid values are ACTIVE or INACTIVE. If not specified, it will include both Active and Inactive status . [optional] # noqa: E501 - privacy (str): Privacy setting of the stream. Valid values are PUBLIC or PRIVATE. If not specified, it will include both public and private streams . [optional] # noqa: E501 - start_date (int): Start date in unix timestamp in millseconds. [optional] # noqa: E501 - end_date (int): End date in unix timestamp in millseconds. If not specified, it assume to be current time.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in stream_types (list) + _items = [] + if self.stream_types: + for _item_stream_types in self.stream_types: + if _item_stream_types: + _items.append(_item_stream_types.to_dict()) + _dict['streamTypes'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2AdminStreamFilter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "streamTypes": [V2AdminStreamType.from_dict(_item) for _item in obj["streamTypes"]] if obj.get("streamTypes") is not None else None, + "scope": obj.get("scope"), + "origin": obj.get("origin"), + "status": obj.get("status"), + "privacy": obj.get("privacy"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.stream_types: List[V2AdminStreamType] = None - self.scope: str = None - self.origin: str = None - self.status: str = None - self.privacy: str = None - self.start_date: int = None - self.end_date: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_admin_stream_info.py b/symphony/bdk/gen/pod_model/v2_admin_stream_info.py index b6644619..619d0289 100644 --- a/symphony/bdk/gen/pod_model/v2_admin_stream_info.py +++ b/symphony/bdk/gen/pod_model/v2_admin_stream_info.py @@ -1,294 +1,105 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.v2_admin_stream_attributes import V2AdminStreamAttributes -globals()['V2AdminStreamAttributes'] = V2AdminStreamAttributes - -class V2AdminStreamInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2AdminStreamInfo(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'is_external': (bool, none_type), # noqa: E501 - 'is_active': (bool, none_type), # noqa: E501 - 'is_public': (bool, none_type), # noqa: E501 - 'type': (str, none_type), # noqa: E501 - 'cross_pod': (bool, none_type), # noqa: E501 - 'origin': (str, none_type), # noqa: E501 - 'attributes': (V2AdminStreamAttributes, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'is_external': 'isExternal', # noqa: E501 - 'is_active': 'isActive', # noqa: E501 - 'is_public': 'isPublic', # noqa: E501 - 'type': 'type', # noqa: E501 - 'cross_pod': 'crossPod', # noqa: E501 - 'origin': 'origin', # noqa: E501 - 'attributes': 'attributes', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + Stream information + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="stream id") + is_external: Optional[StrictBool] = Field(default=None, description="true indicate this stream has the scope of external and false indictate this stream has the scope of internal. Deprecated, use origin", alias="isExternal") + is_active: Optional[StrictBool] = Field(default=None, description="true indicate that this stream has the status of active and false indicate this stream has the scope of inactive", alias="isActive") + is_public: Optional[StrictBool] = Field(default=None, description="true indicate that this stream has a privacy setting of public. This only apply a ROOM stream type.", alias="isPublic") + type: Optional[StrictStr] = Field(default=None, description="type of stream (IM, MIM, ROOM)") + cross_pod: Optional[StrictBool] = Field(default=None, description="If true, this is a cross-pod stream.", alias="crossPod") + origin: Optional[StrictStr] = Field(default=None, description="INTERNAL if the creator of this stream belongs to the pod, EXTERNAL otherwise") + attributes: Optional[V2AdminStreamAttributes] = None + __properties: ClassVar[List[str]] = ["id", "isExternal", "isActive", "isPublic", "type", "crossPod", "origin", "attributes"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2AdminStreamInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): stream id. [optional] # noqa: E501 - is_external (bool): true indicate this stream has the scope of external and false indictate this stream has the scope of internal. Deprecated, use origin. [optional] # noqa: E501 - is_active (bool): true indicate that this stream has the status of active and false indicate this stream has the scope of inactive. [optional] # noqa: E501 - is_public (bool): true indicate that this stream has a privacy setting of public. This only apply a ROOM stream type.. [optional] # noqa: E501 - type (str): type of stream (IM, MIM, ROOM). [optional] # noqa: E501 - cross_pod (bool): If true, this is a cross-pod stream.. [optional] # noqa: E501 - origin (str): INTERNAL if the creator of this stream belongs to the pod, EXTERNAL otherwise. [optional] # noqa: E501 - attributes (V2AdminStreamAttributes): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2AdminStreamInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2AdminStreamInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): stream id. [optional] # noqa: E501 - is_external (bool): true indicate this stream has the scope of external and false indictate this stream has the scope of internal. Deprecated, use origin. [optional] # noqa: E501 - is_active (bool): true indicate that this stream has the status of active and false indicate this stream has the scope of inactive. [optional] # noqa: E501 - is_public (bool): true indicate that this stream has a privacy setting of public. This only apply a ROOM stream type.. [optional] # noqa: E501 - type (str): type of stream (IM, MIM, ROOM). [optional] # noqa: E501 - cross_pod (bool): If true, this is a cross-pod stream.. [optional] # noqa: E501 - origin (str): INTERNAL if the creator of this stream belongs to the pod, EXTERNAL otherwise. [optional] # noqa: E501 - attributes (V2AdminStreamAttributes): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of attributes + if self.attributes: + _dict['attributes'] = self.attributes.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2AdminStreamInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "isExternal": obj.get("isExternal"), + "isActive": obj.get("isActive"), + "isPublic": obj.get("isPublic"), + "type": obj.get("type"), + "crossPod": obj.get("crossPod"), + "origin": obj.get("origin"), + "attributes": V2AdminStreamAttributes.from_dict(obj["attributes"]) if obj.get("attributes") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.is_external: bool = None - self.is_active: bool = None - self.is_public: bool = None - self.type: str = None - self.cross_pod: bool = None - self.origin: str = None - self.attributes: V2AdminStreamAttributes = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_admin_stream_info_list.py b/symphony/bdk/gen/pod_model/v2_admin_stream_info_list.py deleted file mode 100644 index be20cd01..00000000 --- a/symphony/bdk/gen/pod_model/v2_admin_stream_info_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.v2_admin_stream_info import V2AdminStreamInfo -globals()['V2AdminStreamInfo'] = V2AdminStreamInfo - -class V2AdminStreamInfoList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V2AdminStreamInfo],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V2AdminStreamInfoList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2AdminStreamInfo]): list of stream info. # noqa: E501 - - Keyword Args: - value ([V2AdminStreamInfo]): list of stream info. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V2AdminStreamInfo] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V2AdminStreamInfoList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2AdminStreamInfo]): list of stream info. # noqa: E501 - - Keyword Args: - value ([V2AdminStreamInfo]): list of stream info. # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/v2_admin_stream_list.py b/symphony/bdk/gen/pod_model/v2_admin_stream_list.py index d95a5577..d3a058e9 100644 --- a/symphony/bdk/gen/pod_model/v2_admin_stream_list.py +++ b/symphony/bdk/gen/pod_model/v2_admin_stream_list.py @@ -1,281 +1,107 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.v2_admin_stream_filter import V2AdminStreamFilter -from symphony.bdk.gen.pod_model.v2_admin_stream_info_list import V2AdminStreamInfoList -globals()['V2AdminStreamFilter'] = V2AdminStreamFilter -globals()['V2AdminStreamInfoList'] = V2AdminStreamInfoList - -class V2AdminStreamList(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from symphony.bdk.gen.pod_model.v2_admin_stream_info import V2AdminStreamInfo +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2AdminStreamList(BaseModel): """ + list of streams info + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="total number of streams which match the filter criteria") + skip: Optional[StrictInt] = Field(default=None, description="number of streams skipped") + limit: Optional[StrictInt] = Field(default=None, description="maximum number of streams return") + filter: Optional[V2AdminStreamFilter] = None + streams: Optional[List[V2AdminStreamInfo]] = Field(default=None, description="list of stream info") + __properties: ClassVar[List[str]] = ["count", "skip", "limit", "filter", "streams"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2AdminStreamList from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'count': (int, none_type), # noqa: E501 - 'skip': (int, none_type), # noqa: E501 - 'limit': (int, none_type), # noqa: E501 - 'filter': (V2AdminStreamFilter, none_type), # noqa: E501 - 'streams': (V2AdminStreamInfoList, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'count': 'count', # noqa: E501 - 'skip': 'skip', # noqa: E501 - 'limit': 'limit', # noqa: E501 - 'filter': 'filter', # noqa: E501 - 'streams': 'streams', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of filter + if self.filter: + _dict['filter'] = self.filter.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in streams (list) + _items = [] + if self.streams: + for _item_streams in self.streams: + if _item_streams: + _items.append(_item_streams.to_dict()) + _dict['streams'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2AdminStreamList - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): total number of streams which match the filter criteria. [optional] # noqa: E501 - skip (int): number of streams skipped. [optional] # noqa: E501 - limit (int): maximum number of streams return. [optional] # noqa: E501 - filter (V2AdminStreamFilter): [optional] # noqa: E501 - streams (V2AdminStreamInfoList): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2AdminStreamList - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): total number of streams which match the filter criteria. [optional] # noqa: E501 - skip (int): number of streams skipped. [optional] # noqa: E501 - limit (int): maximum number of streams return. [optional] # noqa: E501 - filter (V2AdminStreamFilter): [optional] # noqa: E501 - streams (V2AdminStreamInfoList): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2AdminStreamList from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "count": obj.get("count"), + "skip": obj.get("skip"), + "limit": obj.get("limit"), + "filter": V2AdminStreamFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, + "streams": [V2AdminStreamInfo.from_dict(_item) for _item in obj["streams"]] if obj.get("streams") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.count: int = None - self.skip: int = None - self.limit: int = None - self.filter: V2AdminStreamFilter = None - self.streams: V2AdminStreamInfoList = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_admin_stream_type.py b/symphony/bdk/gen/pod_model/v2_admin_stream_type.py index b6b8480d..bd05ba6e 100644 --- a/symphony/bdk/gen/pod_model/v2_admin_stream_type.py +++ b/symphony/bdk/gen/pod_model/v2_admin_stream_type.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2AdminStreamType(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V2AdminStreamType(BaseModel): + """ + V2AdminStreamType + """ # noqa: E501 + type: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'type': 'type', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2AdminStreamType - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2AdminStreamType from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2AdminStreamType - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2AdminStreamType from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_conversation_specific_stream_attributes.py b/symphony/bdk/gen/pod_model/v2_conversation_specific_stream_attributes.py index 90ca25e5..58d1fd72 100644 --- a/symphony/bdk/gen/pod_model/v2_conversation_specific_stream_attributes.py +++ b/symphony/bdk/gen/pod_model/v2_conversation_specific_stream_attributes.py @@ -1,259 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.user_id_list import UserIdList -globals()['UserIdList'] = UserIdList - -class V2ConversationSpecificStreamAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'members': (UserIdList, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V2ConversationSpecificStreamAttributes(BaseModel): + """ + V2ConversationSpecificStreamAttributes + """ # noqa: E501 + members: Optional[List[StrictInt]] = None + __properties: ClassVar[List[str]] = ["members"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'members': 'members', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2ConversationSpecificStreamAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - members (UserIdList): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2ConversationSpecificStreamAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2ConversationSpecificStreamAttributes - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - members (UserIdList): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2ConversationSpecificStreamAttributes from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "members": obj.get("members") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.members: UserIdList = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_member_info.py b/symphony/bdk/gen/pod_model/v2_member_info.py index bb4fd1d2..dae1c1a1 100644 --- a/symphony/bdk/gen/pod_model/v2_member_info.py +++ b/symphony/bdk/gen/pod_model/v2_member_info.py @@ -1,279 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.v2_member_user_detail import V2MemberUserDetail -globals()['V2MemberUserDetail'] = V2MemberUserDetail - -class V2MemberInfo(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2MemberInfo(BaseModel): """ + Detailed membership record. + """ # noqa: E501 + user: Optional[V2MemberUserDetail] = None + is_owner: Optional[StrictBool] = Field(default=None, description="true if this is an owner of the room", alias="isOwner") + is_creator: Optional[StrictBool] = Field(default=None, description="true if this is the creator of the room", alias="isCreator") + join_date: Optional[StrictInt] = Field(default=None, description="unix timestamp for join date", alias="joinDate") + added_through_groups: Optional[List[StrictInt]] = Field(default=None, description="When the user has been added to the stream through a group (aka SDL), this array contains the group ID which the user belongs to. Since SBE 20.14.", alias="addedThroughGroups") + __properties: ClassVar[List[str]] = ["user", "isOwner", "isCreator", "joinDate", "addedThroughGroups"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2MemberInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'user': (V2MemberUserDetail, none_type), # noqa: E501 - 'is_owner': (bool, none_type), # noqa: E501 - 'is_creator': (bool, none_type), # noqa: E501 - 'join_date': (int, none_type), # noqa: E501 - 'added_through_groups': ([int], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user': 'user', # noqa: E501 - 'is_owner': 'isOwner', # noqa: E501 - 'is_creator': 'isCreator', # noqa: E501 - 'join_date': 'joinDate', # noqa: E501 - 'added_through_groups': 'addedThroughGroups', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user + if self.user: + _dict['user'] = self.user.to_dict() + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2MemberInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user (V2MemberUserDetail): [optional] # noqa: E501 - is_owner (bool): true if this is an owner of the room. [optional] # noqa: E501 - is_creator (bool): true if this is the creator of the room. [optional] # noqa: E501 - join_date (int): unix timestamp for join date. [optional] # noqa: E501 - added_through_groups ([int]): When the user has been added to the stream through a group (aka SDL), this array contains the group ID which the user belongs to. Since SBE 20.14.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2MemberInfo - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user (V2MemberUserDetail): [optional] # noqa: E501 - is_owner (bool): true if this is an owner of the room. [optional] # noqa: E501 - is_creator (bool): true if this is the creator of the room. [optional] # noqa: E501 - join_date (int): unix timestamp for join date. [optional] # noqa: E501 - added_through_groups ([int]): When the user has been added to the stream through a group (aka SDL), this array contains the group ID which the user belongs to. Since SBE 20.14.. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2MemberInfo from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "user": V2MemberUserDetail.from_dict(obj["user"]) if obj.get("user") is not None else None, + "isOwner": obj.get("isOwner"), + "isCreator": obj.get("isCreator"), + "joinDate": obj.get("joinDate"), + "addedThroughGroups": obj.get("addedThroughGroups") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user: V2MemberUserDetail = None - self.is_owner: bool = None - self.is_creator: bool = None - self.join_date: int = None - self.added_through_groups: List[int] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_member_info_list.py b/symphony/bdk/gen/pod_model/v2_member_info_list.py deleted file mode 100644 index 3af6fc2d..00000000 --- a/symphony/bdk/gen/pod_model/v2_member_info_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.v2_member_info import V2MemberInfo -globals()['V2MemberInfo'] = V2MemberInfo - -class V2MemberInfoList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V2MemberInfo],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V2MemberInfoList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2MemberInfo]): # noqa: E501 - - Keyword Args: - value ([V2MemberInfo]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V2MemberInfo] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V2MemberInfoList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2MemberInfo]): # noqa: E501 - - Keyword Args: - value ([V2MemberInfo]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/v2_member_user_detail.py b/symphony/bdk/gen/pod_model/v2_member_user_detail.py index bdec1d60..5058d95b 100644 --- a/symphony/bdk/gen/pod_model/v2_member_user_detail.py +++ b/symphony/bdk/gen/pod_model/v2_member_user_detail.py @@ -1,291 +1,101 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2MemberUserDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_id': (int, none_type), # noqa: E501 - 'email': (str, none_type), # noqa: E501 - 'first_name': (str, none_type), # noqa: E501 - 'last_name': (str, none_type), # noqa: E501 - 'display_name': (str, none_type), # noqa: E501 - 'company': (str, none_type), # noqa: E501 - 'company_id': (int, none_type), # noqa: E501 - 'is_external': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user_id': 'userId', # noqa: E501 - 'email': 'email', # noqa: E501 - 'first_name': 'firstName', # noqa: E501 - 'last_name': 'lastName', # noqa: E501 - 'display_name': 'displayName', # noqa: E501 - 'company': 'company', # noqa: E501 - 'company_id': 'companyId', # noqa: E501 - 'is_external': 'isExternal', # noqa: E501 - } +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - read_only_vars = { - } +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - _composed_schemas = {} +class V2MemberUserDetail(BaseModel): + """ + User detail information for stream membership + """ # noqa: E501 + user_id: Optional[StrictInt] = Field(default=None, alias="userId") + email: Optional[StrictStr] = None + first_name: Optional[StrictStr] = Field(default=None, alias="firstName") + last_name: Optional[StrictStr] = Field(default=None, alias="lastName") + display_name: Optional[StrictStr] = Field(default=None, description="Display name for the user", alias="displayName") + company: Optional[StrictStr] = Field(default=None, description="Company name") + company_id: Optional[StrictInt] = Field(default=None, description="Company ID", alias="companyId") + is_external: Optional[StrictBool] = Field(default=None, description="true indicate that this user belong to another company", alias="isExternal") + __properties: ClassVar[List[str]] = ["userId", "email", "firstName", "lastName", "displayName", "company", "companyId", "isExternal"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2MemberUserDetail - a pod_model defined in OpenAPI + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2MemberUserDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): [optional] # noqa: E501 - email (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - display_name (str): Display name for the user. [optional] # noqa: E501 - company (str): Company name. [optional] # noqa: E501 - company_id (int): Company ID. [optional] # noqa: E501 - is_external (bool): true indicate that this user belong to another company. [optional] # noqa: E501 - """ + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2MemberUserDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): [optional] # noqa: E501 - email (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - display_name (str): Display name for the user. [optional] # noqa: E501 - company (str): Company name. [optional] # noqa: E501 - company_id (int): Company ID. [optional] # noqa: E501 - is_external (bool): true indicate that this user belong to another company. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2MemberUserDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "userId": obj.get("userId"), + "email": obj.get("email"), + "firstName": obj.get("firstName"), + "lastName": obj.get("lastName"), + "displayName": obj.get("displayName"), + "company": obj.get("company"), + "companyId": obj.get("companyId"), + "isExternal": obj.get("isExternal") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_id: int = None - self.email: str = None - self.first_name: str = None - self.last_name: str = None - self.display_name: str = None - self.company: str = None - self.company_id: int = None - self.is_external: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_membership_list.py b/symphony/bdk/gen/pod_model/v2_membership_list.py index 9a271212..508e1260 100644 --- a/symphony/bdk/gen/pod_model/v2_membership_list.py +++ b/symphony/bdk/gen/pod_model/v2_membership_list.py @@ -1,274 +1,101 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.pod_model.v2_member_info_list import V2MemberInfoList -globals()['V2MemberInfoList'] = V2MemberInfoList -class V2MembershipList(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Do not edit the class manually. +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from symphony.bdk.gen.pod_model.v2_member_info import V2MemberInfo +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2MembershipList(BaseModel): """ + List of members in the stream. + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="total members count") + skip: Optional[StrictInt] = Field(default=None, description="number of items to skip from the request") + limit: Optional[StrictInt] = Field(default=None, description="maximum number of items to return") + members: Optional[List[V2MemberInfo]] = None + __properties: ClassVar[List[str]] = ["count", "skip", "limit", "members"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2MembershipList from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'count': (int, none_type), # noqa: E501 - 'skip': (int, none_type), # noqa: E501 - 'limit': (int, none_type), # noqa: E501 - 'members': (V2MemberInfoList, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'count': 'count', # noqa: E501 - 'skip': 'skip', # noqa: E501 - 'limit': 'limit', # noqa: E501 - 'members': 'members', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in members (list) + _items = [] + if self.members: + for _item_members in self.members: + if _item_members: + _items.append(_item_members.to_dict()) + _dict['members'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2MembershipList - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): total members count. [optional] # noqa: E501 - skip (int): number of items to skip from the request. [optional] # noqa: E501 - limit (int): maximum number of items to return. [optional] # noqa: E501 - members (V2MemberInfoList): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2MembershipList - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): total members count. [optional] # noqa: E501 - skip (int): number of items to skip from the request. [optional] # noqa: E501 - limit (int): maximum number of items to return. [optional] # noqa: E501 - members (V2MemberInfoList): [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2MembershipList from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "count": obj.get("count"), + "skip": obj.get("skip"), + "limit": obj.get("limit"), + "members": [V2MemberInfo.from_dict(_item) for _item in obj["members"]] if obj.get("members") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.count: int = None - self.skip: int = None - self.limit: int = None - self.members: V2MemberInfoList = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_presence.py b/symphony/bdk/gen/pod_model/v2_presence.py index 7703dea2..474927f0 100644 --- a/symphony/bdk/gen/pod_model/v2_presence.py +++ b/symphony/bdk/gen/pod_model/v2_presence.py @@ -1,320 +1,91 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.v2_presence_all_of import V2PresenceAllOf -from symphony.bdk.gen.pod_model.v2_user_presence import V2UserPresence -globals()['V2PresenceAllOf'] = V2PresenceAllOf -globals()['V2UserPresence'] = V2UserPresence - -class V2Presence(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'category': (str,), # noqa: E501 - 'user_id': (int, none_type), # noqa: E501 - 'timestamp': (int, none_type), # noqa: E501 - } +class V2Presence(BaseModel): + """ + V2Presence + """ # noqa: E501 + category: StrictStr = Field(description="Presence status. Possible values are: - UNDEFINED - AVAILABLE - BUSY - DO_NOT_DISTURB - ON_THE_PHONE - BE_RIGHT_BACK - IN_A_MEETING - AWAY - OUT_OF_OFFICE - OFF_WORK - OFFLINE ") + user_id: Optional[StrictInt] = Field(default=None, description="The ID of the user to whom the presence state relates.", alias="userId") + timestamp: Optional[StrictInt] = Field(default=None, description="The time, in milliseconds since Jan 1 1970, when the presence state was set.") + __properties: ClassVar[List[str]] = ["category", "userId", "timestamp"] - @cached_property - def discriminator(): - return None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'category': 'category', # noqa: E501 - 'user_id': 'userId', # noqa: E501 - 'timestamp': 'timestamp', # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - read_only_vars = { - } + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2Presence - a pod_model defined in OpenAPI - - Keyword Args: - category (str): Presence status. Possible values are: - UNDEFINED - AVAILABLE - BUSY - DO_NOT_DISTURB - ON_THE_PHONE - BE_RIGHT_BACK - IN_A_MEETING - AWAY - OUT_OF_OFFICE - OFF_WORK - OFFLINE - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): The ID of the user to whom the presence state relates.. [optional] # noqa: E501 - timestamp (int): The time, in milliseconds since Jan 1 1970, when the presence state was set.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2Presence from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2Presence - a pod_model defined in OpenAPI - - Keyword Args: - category (str): Presence status. Possible values are: - UNDEFINED - AVAILABLE - BUSY - DO_NOT_DISTURB - ON_THE_PHONE - BE_RIGHT_BACK - IN_A_MEETING - AWAY - OUT_OF_OFFICE - OFF_WORK - OFFLINE - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): The ID of the user to whom the presence state relates.. [optional] # noqa: E501 - timestamp (int): The time, in milliseconds since Jan 1 1970, when the presence state was set.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2Presence from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "category": obj.get("category"), + "userId": obj.get("userId"), + "timestamp": obj.get("timestamp") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.category: str = kwargs['category'] - self.user_id: int = None - self.timestamp: int = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - V2PresenceAllOf, - V2UserPresence, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/pod_model/v2_presence_all_of.py b/symphony/bdk/gen/pod_model/v2_presence_all_of.py deleted file mode 100644 index daca9259..00000000 --- a/symphony/bdk/gen/pod_model/v2_presence_all_of.py +++ /dev/null @@ -1,256 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2PresenceAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'timestamp': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'timestamp': 'timestamp', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2PresenceAllOf - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - timestamp (int): The time, in milliseconds since Jan 1 1970, when the presence state was set.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2PresenceAllOf - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - timestamp (int): The time, in milliseconds since Jan 1 1970, when the presence state was set.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.timestamp: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_presence_list.py b/symphony/bdk/gen/pod_model/v2_presence_list.py deleted file mode 100644 index b7a11f6f..00000000 --- a/symphony/bdk/gen/pod_model/v2_presence_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.v2_presence import V2Presence -globals()['V2Presence'] = V2Presence - -class V2PresenceList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V2Presence],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V2PresenceList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2Presence]): # noqa: E501 - - Keyword Args: - value ([V2Presence]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V2Presence] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V2PresenceList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2Presence]): # noqa: E501 - - Keyword Args: - value ([V2Presence]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/v2_presence_status.py b/symphony/bdk/gen/pod_model/v2_presence_status.py index 3963845c..b9a919a5 100644 --- a/symphony/bdk/gen/pod_model/v2_presence_status.py +++ b/symphony/bdk/gen/pod_model/v2_presence_status.py @@ -1,261 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2PresenceStatus(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'category': (str,), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V2PresenceStatus(BaseModel): + """ + V2PresenceStatus + """ # noqa: E501 + category: StrictStr = Field(description="Presence status. Possible values are: - UNDEFINED - AVAILABLE - BUSY - DO_NOT_DISTURB - ON_THE_PHONE - BE_RIGHT_BACK - IN_A_MEETING - AWAY - OUT_OF_OFFICE - OFF_WORK - OFFLINE ") + __properties: ClassVar[List[str]] = ["category"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'category': 'category', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, category, *args, **kwargs): # noqa: E501 - """V2PresenceStatus - a pod_model defined in OpenAPI - - Args: - category (str): Presence status. Possible values are: - UNDEFINED - AVAILABLE - BUSY - DO_NOT_DISTURB - ON_THE_PHONE - BE_RIGHT_BACK - IN_A_MEETING - AWAY - OUT_OF_OFFICE - OFF_WORK - OFFLINE - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2PresenceStatus from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.category = category - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, category, *args, **kwargs): # noqa: E501 - """V2PresenceStatus - a pod_model defined in OpenAPI + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - Args: - category (str): Presence status. Possible values are: - UNDEFINED - AVAILABLE - BUSY - DO_NOT_DISTURB - ON_THE_PHONE - BE_RIGHT_BACK - IN_A_MEETING - AWAY - OUT_OF_OFFICE - OFF_WORK - OFFLINE + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2PresenceStatus from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "category": obj.get("category") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.category: str = category - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_room_attributes.py b/symphony/bdk/gen/pod_model/v2_room_attributes.py deleted file mode 100644 index 7170a298..00000000 --- a/symphony/bdk/gen/pod_model/v2_room_attributes.py +++ /dev/null @@ -1,198 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - -from symphony.bdk.gen.pod_model.room_tag import RoomTag -globals()['RoomTag'] = RoomTag - - -class V2RoomAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str, none_type), # noqa: E501 - 'keywords': ([RoomTag], none_type), # noqa: E501 - 'description': (str, none_type), # noqa: E501 - 'members_can_invite': (bool, none_type), # noqa: E501 - 'discoverable': (bool, none_type), # noqa: E501 - 'public': (bool, none_type), # noqa: E501 - 'read_only': (bool, none_type), # noqa: E501 - 'copy_protected': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'name': 'name', # noqa: E501 - 'keywords': 'keywords', # noqa: E501 - 'description': 'description', # noqa: E501 - 'members_can_invite': 'membersCanInvite', # noqa: E501 - 'discoverable': 'discoverable', # noqa: E501 - 'public': 'public', # noqa: E501 - 'read_only': 'readOnly', # noqa: E501 - 'copy_protected': 'copyProtected', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2RoomAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Room name.. [optional] # noqa: E501 - keywords ([RoomTag]): Keywords for search to use to find this room. [optional] # noqa: E501 - description (str): Room description.. [optional] # noqa: E501 - members_can_invite (bool): If true, any chatroom participant can add new participants. If false, only owners can add new participants.. [optional] # noqa: E501 - discoverable (bool): If true, this chatroom (name, description and messages) can be searched and listed by non-participants. If false, only participants can search this room.. [optional] # noqa: E501 - public (bool): If true, this is a public chatroom. IF false, a private chatroom.. [optional] # noqa: E501 - read_only (bool): If true, only stream owners can send messages.. [optional] # noqa: E501 - copy_protected (bool): If true, clients disable the clipboard copy for content in this stream.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.keywords: List[RoomTag] = None - self.description: str = None - self.members_can_invite: bool = None - self.discoverable: bool = None - self.public: bool = None - self.read_only: bool = None - self.copy_protected: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/v2_room_detail.py b/symphony/bdk/gen/pod_model/v2_room_detail.py deleted file mode 100644 index d0573789..00000000 --- a/symphony/bdk/gen/pod_model/v2_room_detail.py +++ /dev/null @@ -1,176 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.12.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) - -from symphony.bdk.gen.pod_model.room_system_info import RoomSystemInfo -from symphony.bdk.gen.pod_model.v2_room_attributes import V2RoomAttributes -globals()['RoomSystemInfo'] = RoomSystemInfo -globals()['V2RoomAttributes'] = V2RoomAttributes - - -class V2RoomDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'room_attributes': (V2RoomAttributes, none_type), # noqa: E501 - 'room_system_info': (RoomSystemInfo, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'room_attributes': 'roomAttributes', # noqa: E501 - 'room_system_info': 'roomSystemInfo', # noqa: E501 - } - - _composed_schemas = {} - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2RoomDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - room_attributes (V2RoomAttributes): [optional] # noqa: E501 - room_system_info (RoomSystemInfo): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.room_attributes: V2RoomAttributes = None - self.room_system_info: RoomSystemInfo = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) diff --git a/symphony/bdk/gen/pod_model/v2_room_search_criteria.py b/symphony/bdk/gen/pod_model/v2_room_search_criteria.py index 3e35a350..7599ce9c 100644 --- a/symphony/bdk/gen/pod_model/v2_room_search_criteria.py +++ b/symphony/bdk/gen/pod_model/v2_room_search_criteria.py @@ -1,356 +1,125 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json -from symphony.bdk.gen.pod_model.room_search_criteria import RoomSearchCriteria +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.user_id import UserId -from symphony.bdk.gen.pod_model.v2_room_search_criteria_all_of import V2RoomSearchCriteriaAllOf -globals()['RoomSearchCriteria'] = RoomSearchCriteria -globals()['UserId'] = UserId -globals()['V2RoomSearchCriteriaAllOf'] = V2RoomSearchCriteriaAllOf - -class V2RoomSearchCriteria(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2RoomSearchCriteria(BaseModel): """ - - allowed_values = { - ('sort_order',): { - 'BASIC': "BASIC", - 'RELEVANCE': "RELEVANCE", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'query': (str,), # noqa: E501 - 'labels': ([str], none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'private': (bool, none_type), # noqa: E501 - 'owner': (UserId, none_type), # noqa: E501 - 'creator': (UserId, none_type), # noqa: E501 - 'member': (UserId, none_type), # noqa: E501 - 'sort_order': (str, none_type), # noqa: E501 - 'sub_type': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'query': 'query', # noqa: E501 - 'labels': 'labels', # noqa: E501 - 'active': 'active', # noqa: E501 - 'private': 'private', # noqa: E501 - 'owner': 'owner', # noqa: E501 - 'creator': 'creator', # noqa: E501 - 'member': 'member', # noqa: E501 - 'sort_order': 'sortOrder', # noqa: E501 - 'sub_type': 'subType', # noqa: E501 - } - - read_only_vars = { - } + Room Query Object. Used to specify the parameters for room search. + """ # noqa: E501 + query: StrictStr = Field(description="The search query. Matches the room name and description.") + labels: Optional[List[StrictStr]] = Field(default=None, description="A list of room tag labels whose values will be queried.") + search_fields: Optional[List[StrictStr]] = Field(default=None, description="The room fields on which to search. Parameter introduced in sbe-25.10.0", alias="searchFields") + active: Optional[StrictBool] = Field(default=None, description="Restrict the search to active/inactive rooms. If unspecified, search all rooms.") + private: Optional[StrictBool] = Field(default=None, description="Restrict the search to private rooms. If unspecified, search all rooms.") + owner: Optional[UserId] = None + creator: Optional[UserId] = None + member: Optional[UserId] = None + sort_order: Optional[StrictStr] = Field(default=None, description="Sort algorithm to be used. Supports two values: \"BASIC\" (legacy algorithm) and \"RELEVANCE\" (enhanced algorithm). ", alias="sortOrder") + sub_type: Optional[StrictStr] = Field(default=None, description="Restrict the search to the specific room subtype. Valid values are: EMAIL", alias="subType") + __properties: ClassVar[List[str]] = ["query", "labels", "searchFields", "active", "private", "owner", "creator", "member", "sortOrder", "subType"] + + @field_validator('sort_order') + def sort_order_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['BASIC', 'RELEVANCE']): + raise ValueError("must be one of enum values ('BASIC', 'RELEVANCE')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2RoomSearchCriteria - a pod_model defined in OpenAPI - - Keyword Args: - query (str): The search query. Matches the room name and description. - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - labels ([str]): A list of room tag labels whose values will be queried.. [optional] # noqa: E501 - active (bool): Restrict the search to active/inactive rooms. If unspecified, search all rooms.. [optional] # noqa: E501 - private (bool): Restrict the search to private rooms. If unspecified, search all rooms.. [optional] # noqa: E501 - owner (UserId): [optional] # noqa: E501 - creator (UserId): [optional] # noqa: E501 - member (UserId): [optional] # noqa: E501 - sort_order (str): Sort algorithm to be used. Supports two values: \"BASIC\" (legacy algorithm) and \"RELEVANCE\" (enhanced algorithm). . [optional] # noqa: E501 - sub_type (str): Restrict the search to the specific room subtype. Valid values are: EMAIL. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2RoomSearchCriteria from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2RoomSearchCriteria - a pod_model defined in OpenAPI - - Keyword Args: - query (str): The search query. Matches the room name and description. - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - labels ([str]): A list of room tag labels whose values will be queried.. [optional] # noqa: E501 - active (bool): Restrict the search to active/inactive rooms. If unspecified, search all rooms.. [optional] # noqa: E501 - private (bool): Restrict the search to private rooms. If unspecified, search all rooms.. [optional] # noqa: E501 - owner (UserId): [optional] # noqa: E501 - creator (UserId): [optional] # noqa: E501 - member (UserId): [optional] # noqa: E501 - sort_order (str): Sort algorithm to be used. Supports two values: \"BASIC\" (legacy algorithm) and \"RELEVANCE\" (enhanced algorithm). . [optional] # noqa: E501 - sub_type (str): Restrict the search to the specific room subtype. Valid values are: EMAIL. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of owner + if self.owner: + _dict['owner'] = self.owner.to_dict() + # override the default output from pydantic by calling `to_dict()` of creator + if self.creator: + _dict['creator'] = self.creator.to_dict() + # override the default output from pydantic by calling `to_dict()` of member + if self.member: + _dict['member'] = self.member.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2RoomSearchCriteria from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "query": obj.get("query"), + "labels": obj.get("labels"), + "searchFields": obj.get("searchFields"), + "active": obj.get("active"), + "private": obj.get("private"), + "owner": UserId.from_dict(obj["owner"]) if obj.get("owner") is not None else None, + "creator": UserId.from_dict(obj["creator"]) if obj.get("creator") is not None else None, + "member": UserId.from_dict(obj["member"]) if obj.get("member") is not None else None, + "sortOrder": obj.get("sortOrder"), + "subType": obj.get("subType") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.query: str = kwargs['query'] - self.labels: List[str] = None - self.active: bool = None - self.private: bool = None - self.owner: UserId = None - self.creator: UserId = None - self.member: UserId = None - self.sort_order: str = None - self.sub_type: str = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - RoomSearchCriteria, - V2RoomSearchCriteriaAllOf, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/pod_model/v2_room_search_criteria_all_of.py b/symphony/bdk/gen/pod_model/v2_room_search_criteria_all_of.py deleted file mode 100644 index e7fbe998..00000000 --- a/symphony/bdk/gen/pod_model/v2_room_search_criteria_all_of.py +++ /dev/null @@ -1,256 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2RoomSearchCriteriaAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'sub_type': (str, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'sub_type': 'subType', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2RoomSearchCriteriaAllOf - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - sub_type (str): Restrict the search to the specific room subtype. Valid values are: EMAIL. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2RoomSearchCriteriaAllOf - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - sub_type (str): Restrict the search to the specific room subtype. Valid values are: EMAIL. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.sub_type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_room_specific_stream_attributes.py b/symphony/bdk/gen/pod_model/v2_room_specific_stream_attributes.py index bc96481a..216489d9 100644 --- a/symphony/bdk/gen/pod_model/v2_room_specific_stream_attributes.py +++ b/symphony/bdk/gen/pod_model/v2_room_specific_stream_attributes.py @@ -1,264 +1,97 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.group_item import GroupItem -globals()['GroupItem'] = GroupItem +from typing import Optional, Set +from typing_extensions import Self -class V2RoomSpecificStreamAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2RoomSpecificStreamAttributes(BaseModel): """ + V2RoomSpecificStreamAttributes + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Room name.") + groups: Optional[List[GroupItem]] = Field(default=None, description="List of groups (aka SDLs) that were added to the room. Since SBE 20.14.") + __properties: ClassVar[List[str]] = ["name", "groups"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str, none_type), # noqa: E501 - 'groups': ([GroupItem], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'name': 'name', # noqa: E501 - 'groups': 'groups', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2RoomSpecificStreamAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Room name.. [optional] # noqa: E501 - groups ([GroupItem]): List of groups (aka SDLs) that were added to the room. Since SBE 20.14.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2RoomSpecificStreamAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2RoomSpecificStreamAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Room name.. [optional] # noqa: E501 - groups ([GroupItem]): List of groups (aka SDLs) that were added to the room. Since SBE 20.14.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in groups (list) + _items = [] + if self.groups: + for _item_groups in self.groups: + if _item_groups: + _items.append(_item_groups.to_dict()) + _dict['groups'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2RoomSpecificStreamAttributes from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "name": obj.get("name"), + "groups": [GroupItem.from_dict(_item) for _item in obj["groups"]] if obj.get("groups") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.groups: List[GroupItem] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_stream_attributes.py b/symphony/bdk/gen/pod_model/v2_stream_attributes.py index 207e11db..d85c561b 100644 --- a/symphony/bdk/gen/pod_model/v2_stream_attributes.py +++ b/symphony/bdk/gen/pod_model/v2_stream_attributes.py @@ -1,298 +1,113 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.v2_conversation_specific_stream_attributes import V2ConversationSpecificStreamAttributes from symphony.bdk.gen.pod_model.v2_room_specific_stream_attributes import V2RoomSpecificStreamAttributes from symphony.bdk.gen.pod_model.v2_stream_type import V2StreamType -globals()['V2ConversationSpecificStreamAttributes'] = V2ConversationSpecificStreamAttributes -globals()['V2RoomSpecificStreamAttributes'] = V2RoomSpecificStreamAttributes -globals()['V2StreamType'] = V2StreamType - -class V2StreamAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2StreamAttributes(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'id': (str, none_type), # noqa: E501 - 'cross_pod': (bool, none_type), # noqa: E501 - 'origin': (str, none_type), # noqa: E501 - 'active': (bool, none_type), # noqa: E501 - 'last_message_date': (int, none_type), # noqa: E501 - 'stream_type': (V2StreamType, none_type), # noqa: E501 - 'stream_attributes': (V2ConversationSpecificStreamAttributes, none_type), # noqa: E501 - 'room_attributes': (V2RoomSpecificStreamAttributes, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'id': 'id', # noqa: E501 - 'cross_pod': 'crossPod', # noqa: E501 - 'origin': 'origin', # noqa: E501 - 'active': 'active', # noqa: E501 - 'last_message_date': 'lastMessageDate', # noqa: E501 - 'stream_type': 'streamType', # noqa: E501 - 'stream_attributes': 'streamAttributes', # noqa: E501 - 'room_attributes': 'roomAttributes', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + V2StreamAttributes + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="The stream ID.") + cross_pod: Optional[StrictBool] = Field(default=None, description="If true, this is a cross-pod stream.", alias="crossPod") + origin: Optional[StrictStr] = Field(default=None, description="INTERNAL if the creator of this stream belongs to the pod, EXTERNAL otherwise") + active: Optional[StrictBool] = Field(default=None, description="If true, this stream is active.") + last_message_date: Optional[StrictInt] = Field(default=None, description="unix timestamp of the last message sent in the stream", alias="lastMessageDate") + stream_type: Optional[V2StreamType] = Field(default=None, alias="streamType") + stream_attributes: Optional[V2ConversationSpecificStreamAttributes] = Field(default=None, alias="streamAttributes") + room_attributes: Optional[V2RoomSpecificStreamAttributes] = Field(default=None, alias="roomAttributes") + __properties: ClassVar[List[str]] = ["id", "crossPod", "origin", "active", "lastMessageDate", "streamType", "streamAttributes", "roomAttributes"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2StreamAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The stream ID.. [optional] # noqa: E501 - cross_pod (bool): If true, this is a cross-pod stream.. [optional] # noqa: E501 - origin (str): INTERNAL if the creator of this stream belongs to the pod, EXTERNAL otherwise. [optional] # noqa: E501 - active (bool): If true, this stream is active.. [optional] # noqa: E501 - last_message_date (int): unix timestamp of the last message sent in the stream. [optional] # noqa: E501 - stream_type (V2StreamType): [optional] # noqa: E501 - stream_attributes (V2ConversationSpecificStreamAttributes): [optional] # noqa: E501 - room_attributes (V2RoomSpecificStreamAttributes): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2StreamAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2StreamAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - id (str): The stream ID.. [optional] # noqa: E501 - cross_pod (bool): If true, this is a cross-pod stream.. [optional] # noqa: E501 - origin (str): INTERNAL if the creator of this stream belongs to the pod, EXTERNAL otherwise. [optional] # noqa: E501 - active (bool): If true, this stream is active.. [optional] # noqa: E501 - last_message_date (int): unix timestamp of the last message sent in the stream. [optional] # noqa: E501 - stream_type (V2StreamType): [optional] # noqa: E501 - stream_attributes (V2ConversationSpecificStreamAttributes): [optional] # noqa: E501 - room_attributes (V2RoomSpecificStreamAttributes): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of stream_type + if self.stream_type: + _dict['streamType'] = self.stream_type.to_dict() + # override the default output from pydantic by calling `to_dict()` of stream_attributes + if self.stream_attributes: + _dict['streamAttributes'] = self.stream_attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of room_attributes + if self.room_attributes: + _dict['roomAttributes'] = self.room_attributes.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2StreamAttributes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "crossPod": obj.get("crossPod"), + "origin": obj.get("origin"), + "active": obj.get("active"), + "lastMessageDate": obj.get("lastMessageDate"), + "streamType": V2StreamType.from_dict(obj["streamType"]) if obj.get("streamType") is not None else None, + "streamAttributes": V2ConversationSpecificStreamAttributes.from_dict(obj["streamAttributes"]) if obj.get("streamAttributes") is not None else None, + "roomAttributes": V2RoomSpecificStreamAttributes.from_dict(obj["roomAttributes"]) if obj.get("roomAttributes") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.id: str = None - self.cross_pod: bool = None - self.origin: str = None - self.active: bool = None - self.last_message_date: int = None - self.stream_type: V2StreamType = None - self.stream_attributes: V2ConversationSpecificStreamAttributes = None - self.room_attributes: V2RoomSpecificStreamAttributes = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_stream_type.py b/symphony/bdk/gen/pod_model/v2_stream_type.py index deec3d84..e92842eb 100644 --- a/symphony/bdk/gen/pod_model/v2_stream_type.py +++ b/symphony/bdk/gen/pod_model/v2_stream_type.py @@ -1,256 +1,87 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2StreamType(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'type': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V2StreamType(BaseModel): + """ + V2StreamType + """ # noqa: E501 + type: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'type': 'type', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2StreamType - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2StreamType from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2StreamType - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - type (str): [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2StreamType from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.type: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_user_attributes.py b/symphony/bdk/gen/pod_model/v2_user_attributes.py index bc22e766..e140a6f5 100644 --- a/symphony/bdk/gen/pod_model/v2_user_attributes.py +++ b/symphony/bdk/gen/pod_model/v2_user_attributes.py @@ -1,384 +1,152 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.v2_user_key_request import V2UserKeyRequest -globals()['V2UserKeyRequest'] = V2UserKeyRequest - -class V2UserAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2UserAttributes(BaseModel): """ - - allowed_values = { - ('account_type',): { - 'NORMAL': "NORMAL", - 'SYSTEM': "SYSTEM", - 'SDL': "SDL", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'email_address': (str, none_type), # noqa: E501 - 'first_name': (str, none_type), # noqa: E501 - 'last_name': (str, none_type), # noqa: E501 - 'user_name': (str, none_type), # noqa: E501 - 'display_name': (str, none_type), # noqa: E501 - 'company_name': (str, none_type), # noqa: E501 - 'department': (str, none_type), # noqa: E501 - 'division': (str, none_type), # noqa: E501 - 'title': (str, none_type), # noqa: E501 - 'work_phone_number': (str, none_type), # noqa: E501 - 'mobile_phone_number': (str, none_type), # noqa: E501 - 'two_factor_auth_phone': (str, none_type), # noqa: E501 - 'sms_number': (str, none_type), # noqa: E501 - 'account_type': (str, none_type), # noqa: E501 - 'location': (str, none_type), # noqa: E501 - 'recommended_language': (str, none_type), # noqa: E501 - 'job_function': (str, none_type), # noqa: E501 - 'asset_classes': ([str], none_type), # noqa: E501 - 'industries': ([str], none_type), # noqa: E501 - 'market_coverage': ([str], none_type), # noqa: E501 - 'responsibility': ([str], none_type), # noqa: E501 - 'function': ([str], none_type), # noqa: E501 - 'instrument': ([str], none_type), # noqa: E501 - 'current_key': (V2UserKeyRequest, none_type), # noqa: E501 - 'previous_key': (V2UserKeyRequest, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'email_address': 'emailAddress', # noqa: E501 - 'first_name': 'firstName', # noqa: E501 - 'last_name': 'lastName', # noqa: E501 - 'user_name': 'userName', # noqa: E501 - 'display_name': 'displayName', # noqa: E501 - 'company_name': 'companyName', # noqa: E501 - 'department': 'department', # noqa: E501 - 'division': 'division', # noqa: E501 - 'title': 'title', # noqa: E501 - 'work_phone_number': 'workPhoneNumber', # noqa: E501 - 'mobile_phone_number': 'mobilePhoneNumber', # noqa: E501 - 'two_factor_auth_phone': 'twoFactorAuthPhone', # noqa: E501 - 'sms_number': 'smsNumber', # noqa: E501 - 'account_type': 'accountType', # noqa: E501 - 'location': 'location', # noqa: E501 - 'recommended_language': 'recommendedLanguage', # noqa: E501 - 'job_function': 'jobFunction', # noqa: E501 - 'asset_classes': 'assetClasses', # noqa: E501 - 'industries': 'industries', # noqa: E501 - 'market_coverage': 'marketCoverage', # noqa: E501 - 'responsibility': 'responsibility', # noqa: E501 - 'function': 'function', # noqa: E501 - 'instrument': 'instrument', # noqa: E501 - 'current_key': 'currentKey', # noqa: E501 - 'previous_key': 'previousKey', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + V2 User record. + """ # noqa: E501 + email_address: Optional[StrictStr] = Field(default=None, alias="emailAddress") + first_name: Optional[StrictStr] = Field(default=None, alias="firstName") + last_name: Optional[StrictStr] = Field(default=None, alias="lastName") + user_name: Optional[StrictStr] = Field(default=None, alias="userName") + display_name: Optional[StrictStr] = Field(default=None, alias="displayName") + company_name: Optional[StrictStr] = Field(default=None, alias="companyName") + department: Optional[StrictStr] = None + division: Optional[StrictStr] = None + title: Optional[StrictStr] = None + work_phone_number: Optional[StrictStr] = Field(default=None, alias="workPhoneNumber") + mobile_phone_number: Optional[StrictStr] = Field(default=None, alias="mobilePhoneNumber") + two_factor_auth_phone: Optional[StrictStr] = Field(default=None, alias="twoFactorAuthPhone") + sms_number: Optional[StrictStr] = Field(default=None, alias="smsNumber") + account_type: Optional[StrictStr] = Field(default=None, alias="accountType") + location: Optional[StrictStr] = None + recommended_language: Optional[StrictStr] = Field(default=None, alias="recommendedLanguage") + job_function: Optional[StrictStr] = Field(default=None, alias="jobFunction") + asset_classes: Optional[List[StrictStr]] = Field(default=None, alias="assetClasses") + industries: Optional[List[StrictStr]] = None + market_coverage: Optional[List[StrictStr]] = Field(default=None, alias="marketCoverage") + responsibility: Optional[List[StrictStr]] = None + function: Optional[List[StrictStr]] = None + instrument: Optional[List[StrictStr]] = None + current_key: Optional[V2UserKeyRequest] = Field(default=None, alias="currentKey") + previous_key: Optional[V2UserKeyRequest] = Field(default=None, alias="previousKey") + __properties: ClassVar[List[str]] = ["emailAddress", "firstName", "lastName", "userName", "displayName", "companyName", "department", "division", "title", "workPhoneNumber", "mobilePhoneNumber", "twoFactorAuthPhone", "smsNumber", "accountType", "location", "recommendedLanguage", "jobFunction", "assetClasses", "industries", "marketCoverage", "responsibility", "function", "instrument", "currentKey", "previousKey"] + + @field_validator('account_type') + def account_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['NORMAL', 'SYSTEM', 'SDL']): + raise ValueError("must be one of enum values ('NORMAL', 'SYSTEM', 'SDL')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2UserAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - email_address (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - user_name (str): [optional] # noqa: E501 - display_name (str): [optional] # noqa: E501 - company_name (str): [optional] # noqa: E501 - department (str): [optional] # noqa: E501 - division (str): [optional] # noqa: E501 - title (str): [optional] # noqa: E501 - work_phone_number (str): [optional] # noqa: E501 - mobile_phone_number (str): [optional] # noqa: E501 - two_factor_auth_phone (str): [optional] # noqa: E501 - sms_number (str): [optional] # noqa: E501 - account_type (str): [optional] # noqa: E501 - location (str): [optional] # noqa: E501 - recommended_language (str): [optional] # noqa: E501 - job_function (str): [optional] # noqa: E501 - asset_classes ([str]): [optional] # noqa: E501 - industries ([str]): [optional] # noqa: E501 - market_coverage ([str]): [optional] # noqa: E501 - responsibility ([str]): [optional] # noqa: E501 - function ([str]): [optional] # noqa: E501 - instrument ([str]): [optional] # noqa: E501 - current_key (V2UserKeyRequest): [optional] # noqa: E501 - previous_key (V2UserKeyRequest): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2UserAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2UserAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - email_address (str): [optional] # noqa: E501 - first_name (str): [optional] # noqa: E501 - last_name (str): [optional] # noqa: E501 - user_name (str): [optional] # noqa: E501 - display_name (str): [optional] # noqa: E501 - company_name (str): [optional] # noqa: E501 - department (str): [optional] # noqa: E501 - division (str): [optional] # noqa: E501 - title (str): [optional] # noqa: E501 - work_phone_number (str): [optional] # noqa: E501 - mobile_phone_number (str): [optional] # noqa: E501 - two_factor_auth_phone (str): [optional] # noqa: E501 - sms_number (str): [optional] # noqa: E501 - account_type (str): [optional] # noqa: E501 - location (str): [optional] # noqa: E501 - recommended_language (str): [optional] # noqa: E501 - job_function (str): [optional] # noqa: E501 - asset_classes ([str]): [optional] # noqa: E501 - industries ([str]): [optional] # noqa: E501 - market_coverage ([str]): [optional] # noqa: E501 - responsibility ([str]): [optional] # noqa: E501 - function ([str]): [optional] # noqa: E501 - instrument ([str]): [optional] # noqa: E501 - current_key (V2UserKeyRequest): [optional] # noqa: E501 - previous_key (V2UserKeyRequest): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of current_key + if self.current_key: + _dict['currentKey'] = self.current_key.to_dict() + # override the default output from pydantic by calling `to_dict()` of previous_key + if self.previous_key: + _dict['previousKey'] = self.previous_key.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2UserAttributes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "emailAddress": obj.get("emailAddress"), + "firstName": obj.get("firstName"), + "lastName": obj.get("lastName"), + "userName": obj.get("userName"), + "displayName": obj.get("displayName"), + "companyName": obj.get("companyName"), + "department": obj.get("department"), + "division": obj.get("division"), + "title": obj.get("title"), + "workPhoneNumber": obj.get("workPhoneNumber"), + "mobilePhoneNumber": obj.get("mobilePhoneNumber"), + "twoFactorAuthPhone": obj.get("twoFactorAuthPhone"), + "smsNumber": obj.get("smsNumber"), + "accountType": obj.get("accountType"), + "location": obj.get("location"), + "recommendedLanguage": obj.get("recommendedLanguage"), + "jobFunction": obj.get("jobFunction"), + "assetClasses": obj.get("assetClasses"), + "industries": obj.get("industries"), + "marketCoverage": obj.get("marketCoverage"), + "responsibility": obj.get("responsibility"), + "function": obj.get("function"), + "instrument": obj.get("instrument"), + "currentKey": V2UserKeyRequest.from_dict(obj["currentKey"]) if obj.get("currentKey") is not None else None, + "previousKey": V2UserKeyRequest.from_dict(obj["previousKey"]) if obj.get("previousKey") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.email_address: str = None - self.first_name: str = None - self.last_name: str = None - self.user_name: str = None - self.display_name: str = None - self.company_name: str = None - self.department: str = None - self.division: str = None - self.title: str = None - self.work_phone_number: str = None - self.mobile_phone_number: str = None - self.two_factor_auth_phone: str = None - self.sms_number: str = None - self.account_type: str = None - self.location: str = None - self.recommended_language: str = None - self.job_function: str = None - self.asset_classes: List[str] = None - self.industries: List[str] = None - self.market_coverage: List[str] = None - self.responsibility: List[str] = None - self.function: List[str] = None - self.instrument: List[str] = None - self.current_key: V2UserKeyRequest = None - self.previous_key: V2UserKeyRequest = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_user_create.py b/symphony/bdk/gen/pod_model/v2_user_create.py index 68d017b0..a10f9355 100644 --- a/symphony/bdk/gen/pod_model/v2_user_create.py +++ b/symphony/bdk/gen/pod_model/v2_user_create.py @@ -1,271 +1,99 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.password import Password from symphony.bdk.gen.pod_model.v2_user_attributes import V2UserAttributes -globals()['Password'] = Password -globals()['V2UserAttributes'] = V2UserAttributes +from typing import Optional, Set +from typing_extensions import Self -class V2UserCreate(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2UserCreate(BaseModel): """ + V2 User Creation Object. After creation, modify roles, features etc via the specific API calls. + """ # noqa: E501 + user_attributes: Optional[V2UserAttributes] = Field(default=None, alias="userAttributes") + password: Optional[Password] = None + roles: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["userAttributes", "password", "roles"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_attributes': (V2UserAttributes, none_type), # noqa: E501 - 'password': (Password, none_type), # noqa: E501 - 'roles': ([str], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user_attributes': 'userAttributes', # noqa: E501 - 'password': 'password', # noqa: E501 - 'roles': 'roles', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2UserCreate - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_attributes (V2UserAttributes): [optional] # noqa: E501 - password (Password): [optional] # noqa: E501 - roles ([str]): [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2UserCreate from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2UserCreate - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_attributes (V2UserAttributes): [optional] # noqa: E501 - password (Password): [optional] # noqa: E501 - roles ([str]): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user_attributes + if self.user_attributes: + _dict['userAttributes'] = self.user_attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of password + if self.password: + _dict['password'] = self.password.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2UserCreate from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "userAttributes": V2UserAttributes.from_dict(obj["userAttributes"]) if obj.get("userAttributes") is not None else None, + "password": Password.from_dict(obj["password"]) if obj.get("password") is not None else None, + "roles": obj.get("roles") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_attributes: V2UserAttributes = None - self.password: Password = None - self.roles: List[str] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_user_detail.py b/symphony/bdk/gen/pod_model/v2_user_detail.py index 0568fd01..66b72f2b 100644 --- a/symphony/bdk/gen/pod_model/v2_user_detail.py +++ b/symphony/bdk/gen/pod_model/v2_user_detail.py @@ -1,302 +1,113 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.avatar import Avatar -from symphony.bdk.gen.pod_model.integer_list import IntegerList -from symphony.bdk.gen.pod_model.string_list import StringList from symphony.bdk.gen.pod_model.user_system_info import UserSystemInfo from symphony.bdk.gen.pod_model.v2_user_attributes import V2UserAttributes -globals()['Avatar'] = Avatar -globals()['IntegerList'] = IntegerList -globals()['StringList'] = StringList -globals()['UserSystemInfo'] = UserSystemInfo -globals()['V2UserAttributes'] = V2UserAttributes - -class V2UserDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2UserDetail(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_attributes': (V2UserAttributes, none_type), # noqa: E501 - 'user_system_info': (UserSystemInfo, none_type), # noqa: E501 - 'features': (IntegerList, none_type), # noqa: E501 - 'apps': (IntegerList, none_type), # noqa: E501 - 'groups': (IntegerList, none_type), # noqa: E501 - 'roles': (StringList, none_type), # noqa: E501 - 'disclaimers': (IntegerList, none_type), # noqa: E501 - 'avatar': (Avatar, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user_attributes': 'userAttributes', # noqa: E501 - 'user_system_info': 'userSystemInfo', # noqa: E501 - 'features': 'features', # noqa: E501 - 'apps': 'apps', # noqa: E501 - 'groups': 'groups', # noqa: E501 - 'roles': 'roles', # noqa: E501 - 'disclaimers': 'disclaimers', # noqa: E501 - 'avatar': 'avatar', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + V2 Detailed User record. + """ # noqa: E501 + user_attributes: Optional[V2UserAttributes] = Field(default=None, alias="userAttributes") + user_system_info: Optional[UserSystemInfo] = Field(default=None, alias="userSystemInfo") + features: Optional[List[StrictInt]] = None + apps: Optional[List[StrictInt]] = None + groups: Optional[List[StrictInt]] = None + roles: Optional[List[StrictStr]] = None + disclaimers: Optional[List[StrictInt]] = None + avatar: Optional[Avatar] = None + __properties: ClassVar[List[str]] = ["userAttributes", "userSystemInfo", "features", "apps", "groups", "roles", "disclaimers", "avatar"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2UserDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_attributes (V2UserAttributes): [optional] # noqa: E501 - user_system_info (UserSystemInfo): [optional] # noqa: E501 - features (IntegerList): [optional] # noqa: E501 - apps (IntegerList): [optional] # noqa: E501 - groups (IntegerList): [optional] # noqa: E501 - roles (StringList): [optional] # noqa: E501 - disclaimers (IntegerList): [optional] # noqa: E501 - avatar (Avatar): [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2UserDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2UserDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_attributes (V2UserAttributes): [optional] # noqa: E501 - user_system_info (UserSystemInfo): [optional] # noqa: E501 - features (IntegerList): [optional] # noqa: E501 - apps (IntegerList): [optional] # noqa: E501 - groups (IntegerList): [optional] # noqa: E501 - roles (StringList): [optional] # noqa: E501 - disclaimers (IntegerList): [optional] # noqa: E501 - avatar (Avatar): [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of user_attributes + if self.user_attributes: + _dict['userAttributes'] = self.user_attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of user_system_info + if self.user_system_info: + _dict['userSystemInfo'] = self.user_system_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of avatar + if self.avatar: + _dict['avatar'] = self.avatar.to_dict() + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2UserDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "userAttributes": V2UserAttributes.from_dict(obj["userAttributes"]) if obj.get("userAttributes") is not None else None, + "userSystemInfo": UserSystemInfo.from_dict(obj["userSystemInfo"]) if obj.get("userSystemInfo") is not None else None, + "features": obj.get("features"), + "apps": obj.get("apps"), + "groups": obj.get("groups"), + "roles": obj.get("roles"), + "disclaimers": obj.get("disclaimers"), + "avatar": Avatar.from_dict(obj["avatar"]) if obj.get("avatar") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.user_attributes: V2UserAttributes = None - self.user_system_info: UserSystemInfo = None - self.features: IntegerList = None - self.apps: IntegerList = None - self.groups: IntegerList = None - self.roles: StringList = None - self.disclaimers: IntegerList = None - self.avatar: Avatar = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_user_detail_list.py b/symphony/bdk/gen/pod_model/v2_user_detail_list.py deleted file mode 100644 index aa6c0913..00000000 --- a/symphony/bdk/gen/pod_model/v2_user_detail_list.py +++ /dev/null @@ -1,281 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.v2_user_detail import V2UserDetail -globals()['V2UserDetail'] = V2UserDetail - -class V2UserDetailList(ModelSimple): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - additional_properties_type = None - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'value': ([V2UserDetail],), - } - - @cached_property - def discriminator(): - return None - - - attribute_map = {} - - read_only_vars = set() - - _composed_schemas = None - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): - """V2UserDetailList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2UserDetail]): # noqa: E501 - - Keyword Args: - value ([V2UserDetail]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value: List[V2UserDetail] = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): - """V2UserDetailList - a pod_model defined in OpenAPI - - Note that value can be passed either in args or in kwargs, but not in both. - - Args: - args[0] ([V2UserDetail]): # noqa: E501 - - Keyword Args: - value ([V2UserDetail]): # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - """ - # required up here when default value is not given - _path_to_item = kwargs.pop('_path_to_item', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if 'value' in kwargs: - value = kwargs.pop('value') - elif args: - args = list(args) - value = args.pop(0) - else: - raise ApiTypeError( - "value is required, but not passed in args or kwargs and doesn't have default", - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.value = value - if kwargs: - raise ApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( - kwargs, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - return self diff --git a/symphony/bdk/gen/pod_model/v2_user_key_request.py b/symphony/bdk/gen/pod_model/v2_user_key_request.py index 94af9128..0bd2e869 100644 --- a/symphony/bdk/gen/pod_model/v2_user_key_request.py +++ b/symphony/bdk/gen/pod_model/v2_user_key_request.py @@ -1,266 +1,91 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2UserKeyRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'key': (str, none_type), # noqa: E501 - 'expiration_date': (int, none_type), # noqa: E501 - 'action': (str, none_type), # noqa: E501 - } +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - @cached_property - def discriminator(): - return None +class V2UserKeyRequest(BaseModel): + """ + User RSA key information. + """ # noqa: E501 + key: Optional[StrictStr] = Field(default=None, description="User RSA public key.") + expiration_date: Optional[StrictInt] = Field(default=None, description="RSA key expiration date. This value is set just for rotated keys.", alias="expirationDate") + action: Optional[StrictStr] = Field(default=None, description="Action to be performed on the RSA key. The following actions can be performed onto the user's active RSA key: - SAVE - REVOKE The following actions can be performed onto the user's rotated RSA key: - REVOKE - EXTEND ") + __properties: ClassVar[List[str]] = ["key", "expirationDate", "action"] + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'key': 'key', # noqa: E501 - 'expiration_date': 'expirationDate', # noqa: E501 - 'action': 'action', # noqa: E501 - } - read_only_vars = { - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2UserKeyRequest - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - key (str): User RSA public key.. [optional] # noqa: E501 - expiration_date (int): RSA key expiration date. This value is set just for rotated keys.. [optional] # noqa: E501 - action (str): Action to be performed on the RSA key. The following actions can be performed onto the user's active RSA key: - SAVE - REVOKE The following actions can be performed onto the user's rotated RSA key: - REVOKE - EXTEND . [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2UserKeyRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2UserKeyRequest - a pod_model defined in OpenAPI + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - key (str): User RSA public key.. [optional] # noqa: E501 - expiration_date (int): RSA key expiration date. This value is set just for rotated keys.. [optional] # noqa: E501 - action (str): Action to be performed on the RSA key. The following actions can be performed onto the user's active RSA key: - SAVE - REVOKE The following actions can be performed onto the user's rotated RSA key: - REVOKE - EXTEND . [optional] # noqa: E501 - """ + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2UserKeyRequest from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "key": obj.get("key"), + "expirationDate": obj.get("expirationDate"), + "action": obj.get("action") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.key: str = None - self.expiration_date: int = None - self.action: str = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_user_list.py b/symphony/bdk/gen/pod_model/v2_user_list.py index f75a0cf0..0c676e0f 100644 --- a/symphony/bdk/gen/pod_model/v2_user_list.py +++ b/symphony/bdk/gen/pod_model/v2_user_list.py @@ -1,266 +1,105 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.user_error import UserError from symphony.bdk.gen.pod_model.user_v2 import UserV2 -globals()['UserError'] = UserError -globals()['UserV2'] = UserV2 +from typing import Optional, Set +from typing_extensions import Self -class V2UserList(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V2UserList(BaseModel): """ + List of User record version 2 + """ # noqa: E501 + users: Optional[List[UserV2]] = Field(default=None, description="List of all users found with the search") + errors: Optional[List[UserError]] = Field(default=None, description="List of all errors found with the informed search criteria") + __properties: ClassVar[List[str]] = ["users", "errors"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'users': ([UserV2], none_type), # noqa: E501 - 'errors': ([UserError], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'users': 'users', # noqa: E501 - 'errors': 'errors', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2UserList - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - users ([UserV2]): List of all users found with the search. [optional] # noqa: E501 - errors ([UserError]): List of all errors found with the informed search criteria. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2UserList from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2UserList - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - users ([UserV2]): List of all users found with the search. [optional] # noqa: E501 - errors ([UserError]): List of all errors found with the informed search criteria. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in users (list) + _items = [] + if self.users: + for _item_users in self.users: + if _item_users: + _items.append(_item_users.to_dict()) + _dict['users'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2UserList from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "users": [UserV2.from_dict(_item) for _item in obj["users"]] if obj.get("users") is not None else None, + "errors": [UserError.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.users: List[UserV2] = None - self.errors: List[UserError] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v2_user_presence.py b/symphony/bdk/gen/pod_model/v2_user_presence.py index d2413cc9..f13cbcaa 100644 --- a/symphony/bdk/gen/pod_model/v2_user_presence.py +++ b/symphony/bdk/gen/pod_model/v2_user_presence.py @@ -1,315 +1,89 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -from symphony.bdk.gen.pod_model.v2_presence_status import V2PresenceStatus -from symphony.bdk.gen.pod_model.v2_user_presence_all_of import V2UserPresenceAllOf -globals()['V2PresenceStatus'] = V2PresenceStatus -globals()['V2UserPresenceAllOf'] = V2UserPresenceAllOf - -class V2UserPresence(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech + Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. +""" # noqa: E501 - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False +from __future__ import annotations +import pprint +import re # noqa: F401 +import json - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'category': (str,), # noqa: E501 - 'user_id': (int, none_type), # noqa: E501 - } +class V2UserPresence(BaseModel): + """ + V2UserPresence + """ # noqa: E501 + category: StrictStr = Field(description="Presence status. Possible values are: - UNDEFINED - AVAILABLE - BUSY - DO_NOT_DISTURB - ON_THE_PHONE - BE_RIGHT_BACK - IN_A_MEETING - AWAY - OUT_OF_OFFICE - OFF_WORK - OFFLINE ") + user_id: Optional[StrictInt] = Field(default=None, description="The ID of the user to whom the presence state relates.", alias="userId") + __properties: ClassVar[List[str]] = ["category", "userId"] - @cached_property - def discriminator(): - return None + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - attribute_map = { - 'category': 'category', # noqa: E501 - 'user_id': 'userId', # noqa: E501 - } + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - read_only_vars = { - } + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2UserPresence - a pod_model defined in OpenAPI - - Keyword Args: - category (str): Presence status. Possible values are: - UNDEFINED - AVAILABLE - BUSY - DO_NOT_DISTURB - ON_THE_PHONE - BE_RIGHT_BACK - IN_A_MEETING - AWAY - OUT_OF_OFFICE - OFF_WORK - OFFLINE - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): The ID of the user to whom the presence state relates.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V2UserPresence from a JSON string""" + return cls.from_dict(json.loads(json_str)) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2UserPresence - a pod_model defined in OpenAPI - - Keyword Args: - category (str): Presence status. Possible values are: - UNDEFINED - AVAILABLE - BUSY - DO_NOT_DISTURB - ON_THE_PHONE - BE_RIGHT_BACK - IN_A_MEETING - AWAY - OUT_OF_OFFICE - OFF_WORK - OFFLINE - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): The ID of the user to whom the presence state relates.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V2UserPresence from a dict""" + if obj is None: + return None - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + if not isinstance(obj, dict): + return cls.model_validate(obj) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + _obj = cls.model_validate({ + "category": obj.get("category"), + "userId": obj.get("userId") + }) + return _obj - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_spec_property_naming': _spec_property_naming, - '_configuration': _configuration, - '_visited_composed_classes': self._visited_composed_classes, - } - composed_info = validate_get_composed_info( - constant_args, kwargs, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - discarded_args = composed_info[3] - self.category: str = kwargs['category'] - self.user_id: int = None - for var_name, var_value in kwargs.items(): - if var_name in discarded_args and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self._additional_properties_model_instances: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") - @cached_property - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error because the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - ], - 'allOf': [ - V2PresenceStatus, - V2UserPresenceAllOf, - ], - 'oneOf': [ - ], - } diff --git a/symphony/bdk/gen/pod_model/v2_user_presence_all_of.py b/symphony/bdk/gen/pod_model/v2_user_presence_all_of.py deleted file mode 100644 index 9f6e2562..00000000 --- a/symphony/bdk/gen/pod_model/v2_user_presence_all_of.py +++ /dev/null @@ -1,256 +0,0 @@ -""" - Pod API - - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 - - The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError - - -class V2UserPresenceAllOf(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'user_id': (int, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'user_id': 'userId', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V2UserPresenceAllOf - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): The ID of the user to whom the presence state relates.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V2UserPresenceAllOf - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - user_id (int): The ID of the user to whom the presence state relates.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.user_id: int = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v3_room_attributes.py b/symphony/bdk/gen/pod_model/v3_room_attributes.py index fd6bbf8e..ca3230b0 100644 --- a/symphony/bdk/gen/pod_model/v3_room_attributes.py +++ b/symphony/bdk/gen/pod_model/v3_room_attributes.py @@ -1,329 +1,123 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" - + Generated by OpenAPI Generator (https://openapi-generator.tech) -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union + Do not edit the class manually. +""" # noqa: E501 -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.room_tag import RoomTag -globals()['RoomTag'] = RoomTag - -class V3RoomAttributes(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3RoomAttributes(BaseModel): """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str, none_type), # noqa: E501 - 'keywords': ([RoomTag], none_type), # noqa: E501 - 'description': (str, none_type), # noqa: E501 - 'members_can_invite': (bool, none_type), # noqa: E501 - 'discoverable': (bool, none_type), # noqa: E501 - 'public': (bool, none_type), # noqa: E501 - 'read_only': (bool, none_type), # noqa: E501 - 'copy_protected': (bool, none_type), # noqa: E501 - 'cross_pod': (bool, none_type), # noqa: E501 - 'view_history': (bool, none_type), # noqa: E501 - 'multi_lateral_room': (bool, none_type), # noqa: E501 - 'scheduled_meeting': (bool, none_type), # noqa: E501 - 'sub_type': (str, none_type), # noqa: E501 - 'pinned_message_id': (str, none_type), # noqa: E501 - 'group_chat': (bool, none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'name': 'name', # noqa: E501 - 'keywords': 'keywords', # noqa: E501 - 'description': 'description', # noqa: E501 - 'members_can_invite': 'membersCanInvite', # noqa: E501 - 'discoverable': 'discoverable', # noqa: E501 - 'public': 'public', # noqa: E501 - 'read_only': 'readOnly', # noqa: E501 - 'copy_protected': 'copyProtected', # noqa: E501 - 'cross_pod': 'crossPod', # noqa: E501 - 'view_history': 'viewHistory', # noqa: E501 - 'multi_lateral_room': 'multiLateralRoom', # noqa: E501 - 'scheduled_meeting': 'scheduledMeeting', # noqa: E501 - 'sub_type': 'subType', # noqa: E501 - 'pinned_message_id': 'pinnedMessageId', # noqa: E501 - 'group_chat': 'groupChat', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + V3RoomAttributes + """ # noqa: E501 + name: Optional[StrictStr] = Field(default=None, description="Room name.") + keywords: Optional[List[RoomTag]] = Field(default=None, description="Keywords for search to use to find this room") + description: Optional[StrictStr] = Field(default=None, description="Room description.") + members_can_invite: Optional[StrictBool] = Field(default=None, description="If true, any chatroom participant can add new participants. If false, only owners can add new participants.", alias="membersCanInvite") + discoverable: Optional[StrictBool] = Field(default=None, description="If true, this chatroom (name, description and messages) can be searched and listed by non-participants. If false, only participants can search this room.") + public: Optional[StrictBool] = Field(default=None, description="If true, this is a public chatroom. IF false, a private chatroom.") + read_only: Optional[StrictBool] = Field(default=None, description="If true, only stream owners can send messages.", alias="readOnly") + copy_protected: Optional[StrictBool] = Field(default=None, description="If true, clients disable the clipboard copy for content in this stream.", alias="copyProtected") + cross_pod: Optional[StrictBool] = Field(default=None, description="If true, this room is a cross pod room", alias="crossPod") + view_history: Optional[StrictBool] = Field(default=None, description="If true, new members can view the room chat history of the room.", alias="viewHistory") + multi_lateral_room: Optional[StrictBool] = Field(default=None, description="If true, this is a multi lateral room where we can find users belonging to more than 2 companies.", alias="multiLateralRoom") + scheduled_meeting: Optional[StrictBool] = Field(default=None, description="If true, this room is for a scheduled meeting.", alias="scheduledMeeting") + sub_type: Optional[StrictStr] = Field(default=None, description="This field is ignored when creating a new room as it was only used for email integration which is now sunset.", alias="subType") + pinned_message_id: Optional[StrictStr] = Field(default=None, description="UrlSafe message id of the pinned message inside the room. To perform unpin operation, send an empty string.", alias="pinnedMessageId") + group_chat: Optional[StrictBool] = Field(default=None, description="If true, this room is a group chat. Note: this parameter is ignored for creating rooms. Since SBE 20.16.", alias="groupChat") + __properties: ClassVar[List[str]] = ["name", "keywords", "description", "membersCanInvite", "discoverable", "public", "readOnly", "copyProtected", "crossPod", "viewHistory", "multiLateralRoom", "scheduledMeeting", "subType", "pinnedMessageId", "groupChat"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V3RoomAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Room name.. [optional] # noqa: E501 - keywords ([RoomTag]): Keywords for search to use to find this room. [optional] # noqa: E501 - description (str): Room description.. [optional] # noqa: E501 - members_can_invite (bool): If true, any chatroom participant can add new participants. If false, only owners can add new participants.. [optional] # noqa: E501 - discoverable (bool): If true, this chatroom (name, description and messages) can be searched and listed by non-participants. If false, only participants can search this room.. [optional] # noqa: E501 - public (bool): If true, this is a public chatroom. IF false, a private chatroom.. [optional] # noqa: E501 - read_only (bool): If true, only stream owners can send messages.. [optional] # noqa: E501 - copy_protected (bool): If true, clients disable the clipboard copy for content in this stream.. [optional] # noqa: E501 - cross_pod (bool): If true, this room is a cross pod room. [optional] # noqa: E501 - view_history (bool): If true, new members can view the room chat history of the room.. [optional] # noqa: E501 - multi_lateral_room (bool): If true, this is a multi lateral room where we can find users belonging to more than 2 companies.. [optional] # noqa: E501 - scheduled_meeting (bool): If true, this room is for a scheduled meeting.. [optional] # noqa: E501 - sub_type (str): This field is ignored when creating a new room as it was only used for email integration which is now sunset.. [optional] # noqa: E501 - pinned_message_id (str): UrlSafe message id of the pinned message inside the room. To perform unpin operation, send an empty string.. [optional] # noqa: E501 - group_chat (bool): If true, this room is a group chat. Note: this parameter is ignored for creating rooms. Since SBE 20.16.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3RoomAttributes from a JSON string""" + return cls.from_dict(json.loads(json_str)) - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V3RoomAttributes - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - name (str): Room name.. [optional] # noqa: E501 - keywords ([RoomTag]): Keywords for search to use to find this room. [optional] # noqa: E501 - description (str): Room description.. [optional] # noqa: E501 - members_can_invite (bool): If true, any chatroom participant can add new participants. If false, only owners can add new participants.. [optional] # noqa: E501 - discoverable (bool): If true, this chatroom (name, description and messages) can be searched and listed by non-participants. If false, only participants can search this room.. [optional] # noqa: E501 - public (bool): If true, this is a public chatroom. IF false, a private chatroom.. [optional] # noqa: E501 - read_only (bool): If true, only stream owners can send messages.. [optional] # noqa: E501 - copy_protected (bool): If true, clients disable the clipboard copy for content in this stream.. [optional] # noqa: E501 - cross_pod (bool): If true, this room is a cross pod room. [optional] # noqa: E501 - view_history (bool): If true, new members can view the room chat history of the room.. [optional] # noqa: E501 - multi_lateral_room (bool): If true, this is a multi lateral room where we can find users belonging to more than 2 companies.. [optional] # noqa: E501 - scheduled_meeting (bool): If true, this room is for a scheduled meeting.. [optional] # noqa: E501 - sub_type (str): This field is ignored when creating a new room as it was only used for email integration which is now sunset.. [optional] # noqa: E501 - pinned_message_id (str): UrlSafe message id of the pinned message inside the room. To perform unpin operation, send an empty string.. [optional] # noqa: E501 - group_chat (bool): If true, this room is a group chat. Note: this parameter is ignored for creating rooms. Since SBE 20.16.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in keywords (list) + _items = [] + if self.keywords: + for _item_keywords in self.keywords: + if _item_keywords: + _items.append(_item_keywords.to_dict()) + _dict['keywords'] = _items + return _dict - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3RoomAttributes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "keywords": [RoomTag.from_dict(_item) for _item in obj["keywords"]] if obj.get("keywords") is not None else None, + "description": obj.get("description"), + "membersCanInvite": obj.get("membersCanInvite"), + "discoverable": obj.get("discoverable"), + "public": obj.get("public"), + "readOnly": obj.get("readOnly"), + "copyProtected": obj.get("copyProtected"), + "crossPod": obj.get("crossPod"), + "viewHistory": obj.get("viewHistory"), + "multiLateralRoom": obj.get("multiLateralRoom"), + "scheduledMeeting": obj.get("scheduledMeeting"), + "subType": obj.get("subType"), + "pinnedMessageId": obj.get("pinnedMessageId"), + "groupChat": obj.get("groupChat") + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.name: str = None - self.keywords: List[RoomTag] = None - self.description: str = None - self.members_can_invite: bool = None - self.discoverable: bool = None - self.public: bool = None - self.read_only: bool = None - self.copy_protected: bool = None - self.cross_pod: bool = None - self.view_history: bool = None - self.multi_lateral_room: bool = None - self.scheduled_meeting: bool = None - self.sub_type: str = None - self.pinned_message_id: str = None - self.group_chat: bool = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v3_room_detail.py b/symphony/bdk/gen/pod_model/v3_room_detail.py index c5da573c..16476224 100644 --- a/symphony/bdk/gen/pod_model/v3_room_detail.py +++ b/symphony/bdk/gen/pod_model/v3_room_detail.py @@ -1,273 +1,107 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.group_item import GroupItem from symphony.bdk.gen.pod_model.room_system_info import RoomSystemInfo from symphony.bdk.gen.pod_model.v3_room_attributes import V3RoomAttributes -globals()['GroupItem'] = GroupItem -globals()['RoomSystemInfo'] = RoomSystemInfo -globals()['V3RoomAttributes'] = V3RoomAttributes +from typing import Optional, Set +from typing_extensions import Self -class V3RoomDetail(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3RoomDetail(BaseModel): """ + V3RoomDetail + """ # noqa: E501 + room_attributes: Optional[V3RoomAttributes] = Field(default=None, alias="roomAttributes") + room_system_info: Optional[RoomSystemInfo] = Field(default=None, alias="roomSystemInfo") + groups: Optional[List[GroupItem]] = Field(default=None, description="List of groups (aka SDLs) that were added to the room.") + __properties: ClassVar[List[str]] = ["roomAttributes", "roomSystemInfo", "groups"] - allowed_values = { - } - - validations = { - } + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - _nullable = False + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'room_attributes': (V3RoomAttributes, none_type), # noqa: E501 - 'room_system_info': (RoomSystemInfo, none_type), # noqa: E501 - 'groups': ([GroupItem], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'room_attributes': 'roomAttributes', # noqa: E501 - 'room_system_info': 'roomSystemInfo', # noqa: E501 - 'groups': 'groups', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V3RoomDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - room_attributes (V3RoomAttributes): [optional] # noqa: E501 - room_system_info (RoomSystemInfo): [optional] # noqa: E501 - groups ([GroupItem]): List of groups (aka SDLs) that were added to the room.. [optional] # noqa: E501 - """ + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3RoomDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - self = super(OpenApiModel, cls).__new__(cls) + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V3RoomDetail - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - room_attributes (V3RoomAttributes): [optional] # noqa: E501 - room_system_info (RoomSystemInfo): [optional] # noqa: E501 - groups ([GroupItem]): List of groups (aka SDLs) that were added to the room.. [optional] # noqa: E501 + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of room_attributes + if self.room_attributes: + _dict['roomAttributes'] = self.room_attributes.to_dict() + # override the default output from pydantic by calling `to_dict()` of room_system_info + if self.room_system_info: + _dict['roomSystemInfo'] = self.room_system_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in groups (list) + _items = [] + if self.groups: + for _item_groups in self.groups: + if _item_groups: + _items.append(_item_groups.to_dict()) + _dict['groups'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3RoomDetail from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "roomAttributes": V3RoomAttributes.from_dict(obj["roomAttributes"]) if obj.get("roomAttributes") is not None else None, + "roomSystemInfo": RoomSystemInfo.from_dict(obj["roomSystemInfo"]) if obj.get("roomSystemInfo") is not None else None, + "groups": [GroupItem.from_dict(_item) for _item in obj["groups"]] if obj.get("groups") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.room_attributes: V3RoomAttributes = None - self.room_system_info: RoomSystemInfo = None - self.groups: List[GroupItem] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/pod_model/v3_room_search_results.py b/symphony/bdk/gen/pod_model/v3_room_search_results.py index 94af44c8..ec01cc5f 100644 --- a/symphony/bdk/gen/pod_model/v3_room_search_results.py +++ b/symphony/bdk/gen/pod_model/v3_room_search_results.py @@ -1,288 +1,117 @@ +# coding: utf-8 + """ Pod API - This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. # noqa: E501 + This document refers to Symphony API calls that do not need encryption or decryption of content. - sessionToken can be obtained by calling the authenticationAPI on the symphony back end and the key manager respectively. Refer to the methods described in authenticatorAPI.yaml. - Actions are defined to be atomic, ie will succeed in their entirety or fail and have changed nothing. - If it returns a 40X status then it will have made no change to the system even if ome subset of the request would have succeeded. - If this contract cannot be met for any reason then this is an error and the response code will be 50X. The version of the OpenAPI document: 20.17.1 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -import re # noqa: F401 -import sys # noqa: F401 -from typing import List, Union - -from symphony.bdk.gen.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, - OpenApiModel -) -from symphony.bdk.gen.exceptions import ApiAttributeError +from __future__ import annotations +import pprint +import re # noqa: F401 +import json +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional from symphony.bdk.gen.pod_model.faceted_match_count import FacetedMatchCount from symphony.bdk.gen.pod_model.v2_room_search_criteria import V2RoomSearchCriteria from symphony.bdk.gen.pod_model.v3_room_detail import V3RoomDetail -globals()['FacetedMatchCount'] = FacetedMatchCount -globals()['V2RoomSearchCriteria'] = V2RoomSearchCriteria -globals()['V3RoomDetail'] = V3RoomDetail - -class V3RoomSearchResults(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. +from typing import Optional, Set +from typing_extensions import Self - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. +class V3RoomSearchResults(BaseModel): """ + A list of search results and counts per search parameter. + """ # noqa: E501 + count: Optional[StrictInt] = Field(default=None, description="The total number of rooms matched by the search.") + skip: Optional[StrictInt] = Field(default=None, description="The number of skipped results.") + limit: Optional[StrictInt] = Field(default=None, description="The number of returned results.") + query: Optional[V2RoomSearchCriteria] = None + rooms: Optional[List[V3RoomDetail]] = Field(default=None, description="A list of rooms matched by the query.") + faceted_match_count: Optional[List[FacetedMatchCount]] = Field(default=None, description="Detailed counts of matched rooms per search criterion.", alias="facetedMatchCount") + __properties: ClassVar[List[str]] = ["count", "skip", "limit", "query", "rooms", "facetedMatchCount"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of V3RoomSearchResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) - _nullable = False + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. - @cached_property - def openapi_types(): - """ - This must be a method because a pod_model may have properties that are - of type self, this must run after the class is loaded + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. """ - return { - 'count': (int, none_type), # noqa: E501 - 'skip': (int, none_type), # noqa: E501 - 'limit': (int, none_type), # noqa: E501 - 'query': (V2RoomSearchCriteria, none_type), # noqa: E501 - 'rooms': ([V3RoomDetail], none_type), # noqa: E501 - 'faceted_match_count': ([FacetedMatchCount], none_type), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'count': 'count', # noqa: E501 - 'skip': 'skip', # noqa: E501 - 'limit': 'limit', # noqa: E501 - 'query': 'query', # noqa: E501 - 'rooms': 'rooms', # noqa: E501 - 'faceted_match_count': 'facetedMatchCount', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of query + if self.query: + _dict['query'] = self.query.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in rooms (list) + _items = [] + if self.rooms: + for _item_rooms in self.rooms: + if _item_rooms: + _items.append(_item_rooms.to_dict()) + _dict['rooms'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in faceted_match_count (list) + _items = [] + if self.faceted_match_count: + for _item_faceted_match_count in self.faceted_match_count: + if _item_faceted_match_count: + _items.append(_item_faceted_match_count.to_dict()) + _dict['facetedMatchCount'] = _items + return _dict @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """V3RoomSearchResults - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): The total number of rooms matched by the search.. [optional] # noqa: E501 - skip (int): The number of skipped results.. [optional] # noqa: E501 - limit (int): The number of returned results.. [optional] # noqa: E501 - query (V2RoomSearchCriteria): [optional] # noqa: E501 - rooms ([V3RoomDetail]): A list of rooms matched by the query.. [optional] # noqa: E501 - faceted_match_count ([FacetedMatchCount]): Detailed counts of matched rooms per search criterion.. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """V3RoomSearchResults - a pod_model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the pod_model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - count (int): The total number of rooms matched by the search.. [optional] # noqa: E501 - skip (int): The number of skipped results.. [optional] # noqa: E501 - limit (int): The number of returned results.. [optional] # noqa: E501 - query (V2RoomSearchCriteria): [optional] # noqa: E501 - rooms ([V3RoomDetail]): A list of rooms matched by the query.. [optional] # noqa: E501 - faceted_match_count ([FacetedMatchCount]): Detailed counts of matched rooms per search criterion.. [optional] # noqa: E501 - """ + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of V3RoomSearchResults from a dict""" + if obj is None: + return None - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + if not isinstance(obj, dict): + return cls.model_validate(obj) - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) + _obj = cls.model_validate({ + "count": obj.get("count"), + "skip": obj.get("skip"), + "limit": obj.get("limit"), + "query": V2RoomSearchCriteria.from_dict(obj["query"]) if obj.get("query") is not None else None, + "rooms": [V3RoomDetail.from_dict(_item) for _item in obj["rooms"]] if obj.get("rooms") is not None else None, + "facetedMatchCount": [FacetedMatchCount.from_dict(_item) for _item in obj["facetedMatchCount"]] if obj.get("facetedMatchCount") is not None else None + }) + return _obj - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.count: int = None - self.skip: int = None - self.limit: int = None - self.query: V2RoomSearchCriteria = None - self.rooms: List[V3RoomDetail] = None - self.faceted_match_count: List[FacetedMatchCount] = None - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/symphony/bdk/gen/rest.py b/symphony/bdk/gen/rest.py index b49e594e..42f707f3 100644 --- a/symphony/bdk/gen/rest.py +++ b/symphony/bdk/gen/rest.py @@ -1,105 +1,121 @@ +# coding: utf-8 + """ Symphony Profile Manager - Profile Manager is a microservice to manage users profile and groups # noqa: E501 + Profile Manager is a microservice to manage users profile and groups The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 import io import json -import logging import re import ssl -from urllib.parse import urlencode +from typing import Optional, Union import aiohttp +import aiohttp_retry from symphony.bdk.gen.exceptions import ApiException, ApiValueError -logger = logging.getLogger(__name__) +RESTResponseType = aiohttp.ClientResponse +ALLOW_RETRY_METHODS = frozenset({'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'TRACE'}) class RESTResponse(io.IOBase): - def __init__(self, resp, data): - self.aiohttp_response = resp + def __init__(self, resp) -> None: + self.response = resp self.status = resp.status self.reason = resp.reason - self.data = data + self.data = None + + async def read(self): + if self.data is None: + self.data = await self.response.read() + return self.data def getheaders(self): """Returns a CIMultiDictProxy of the response headers.""" - return self.aiohttp_response.headers + return self.response.headers def getheader(self, name, default=None): """Returns a given response header.""" - return self.aiohttp_response.headers.get(name, default) + return self.response.headers.get(name, default) -class RESTClientObject(object): +class RESTClientObject: - def __init__(self, configuration, pools_size=4, maxsize=None): + def __init__(self, configuration) -> None: # maxsize is number of requests to host that are allowed in parallel - if maxsize is None: - maxsize = configuration.connection_pool_maxsize - - ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=configuration.ssl_ca_cert) - ssl_context.load_default_certs() - ssl_context.verify_mode = ssl.CERT_REQUIRED + self.maxsize = configuration.connection_pool_maxsize + self.ssl_context = ssl.create_default_context( + cafile=configuration.ssl_ca_cert, + cadata=configuration.ca_cert_data, + ) if configuration.cert_file: - ssl_context.load_cert_chain( + self.ssl_context.load_cert_chain( configuration.cert_file, keyfile=configuration.key_file ) if not configuration.verify_ssl: - ssl_context.check_hostname = False - ssl_context.verify_mode = ssl.CERT_NONE - - connector = aiohttp.TCPConnector( - limit=maxsize, - ssl=ssl_context - ) + self.ssl_context.check_hostname = False + self.ssl_context.verify_mode = ssl.CERT_NONE self.proxy = configuration.proxy self.proxy_headers = configuration.proxy_headers - # https pool manager - self.pool_manager = aiohttp.ClientSession( - connector=connector, - trust_env=True - ) - - async def close(self): - await self.pool_manager.close() - - async def request(self, method, url, query_params=None, headers=None, - body=None, post_params=None, _preload_content=True, - _request_timeout=None): + self.retries = configuration.retries + + self.pool_manager: Optional[aiohttp.ClientSession] = None + self.retry_client: Optional[aiohttp_retry.RetryClient] = None + + async def close(self) -> None: + if self.pool_manager: + await self.pool_manager.close() + if self.retry_client is not None: + await self.retry_client.close() + + async def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): """Execute request :param method: http request method :param url: http request url - :param query_params: query parameters in the url :param headers: http request headers :param body: request json body, for `application/json` :param post_params: request post parameters, `application/x-www-form-urlencoded` and `multipart/form-data` - :param _preload_content: this is a non-applicable field for - the AiohttpClient. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. """ method = method.upper() - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] if post_params and body: raise ApiValueError( @@ -108,6 +124,7 @@ async def request(self, method, url, query_params=None, headers=None, post_params = post_params or {} headers = headers or {} + # url already contains the URL query string timeout = _request_timeout or 5 * 60 if 'Content-Type' not in headers: @@ -125,40 +142,44 @@ async def request(self, method, url, query_params=None, headers=None, if self.proxy_headers: args["proxy_headers"] = self.proxy_headers - if query_params: - args["url"] += '?' + urlencode(query_params) - # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: if re.search('json', headers['Content-Type'], re.IGNORECASE): if body is not None: body = json.dumps(body) args["data"] = body - elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': args["data"] = aiohttp.FormData(post_params) elif headers['Content-Type'] == 'multipart/form-data': # must del headers['Content-Type'], or the correct # Content-Type which generated by aiohttp del headers['Content-Type'] - data = aiohttp.FormData(quote_fields=False) + data = aiohttp.FormData() for param in post_params: k, v = param if isinstance(v, tuple) and len(v) == 3: - data.add_field(k, - value=v[1], - filename=v[0], - content_type=v[2]) + data.add_field( + k, + value=v[1], + filename=v[0], + content_type=v[2] + ) elif isinstance(v, tuple) and len(v) == 2: # needed because of multipart form data payload while sending messages with attachment data.add_field(k, v[0], content_type=v[1]) else: + # Ensures that dict objects are serialized + if isinstance(v, dict): + v = json.dumps(v) + elif isinstance(v, int): + v = str(v) data.add_field(k, v) args["data"] = data - # Pass a `bytes` parameter directly in the body to support + # Pass a `bytes` or `str` parameter directly in the body to support # other content types than Json when `body` argument is provided # in serialized form - elif isinstance(body, bytes): + elif isinstance(body, str) or isinstance(body, bytes): args["data"] = body else: # Cannot generate the request from given parameters @@ -167,84 +188,29 @@ async def request(self, method, url, query_params=None, headers=None, declared content type.""" raise ApiException(status=0, reason=msg) - r = await self.pool_manager.request(**args) - if _preload_content: - - data = await r.read() - r = RESTResponse(r, data) - - # log response body - logger.debug("response body: %s", r.data) - - if not 200 <= r.status <= 299: - raise ApiException(http_resp=r) - - return r - - async def GET(self, url, headers=None, query_params=None, - _preload_content=True, _request_timeout=None): - return (await self.request("GET", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params)) - - async def HEAD(self, url, headers=None, query_params=None, - _preload_content=True, _request_timeout=None): - return (await self.request("HEAD", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params)) - - async def OPTIONS(self, url, headers=None, query_params=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - return (await self.request("OPTIONS", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def DELETE(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None): - return (await self.request("DELETE", url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def POST(self, url, headers=None, query_params=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - return (await self.request("POST", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def PUT(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return (await self.request("PUT", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) - - async def PATCH(self, url, headers=None, query_params=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): - return (await self.request("PATCH", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body)) + pool_manager: Union[aiohttp.ClientSession, aiohttp_retry.RetryClient] + + # https pool manager + if self.pool_manager is None: + self.pool_manager = aiohttp.ClientSession( + connector=aiohttp.TCPConnector(limit=self.maxsize, ssl=self.ssl_context), + trust_env=True, + ) + pool_manager = self.pool_manager + + if self.retries is not None and method in ALLOW_RETRY_METHODS: + if self.retry_client is None: + self.retry_client = aiohttp_retry.RetryClient( + client_session=self.pool_manager, + retry_options=aiohttp_retry.ExponentialRetry( + attempts=self.retries, + factor=2.0, + start_timeout=0.1, + max_timeout=120.0 + ) + ) + pool_manager = self.retry_client + + r = await pool_manager.request(**args) + + return RESTResponse(r) diff --git a/tests/bdk/gen/rest_test.py b/tests/bdk/gen/rest_test.py index 95362511..413f6766 100644 --- a/tests/bdk/gen/rest_test.py +++ b/tests/bdk/gen/rest_test.py @@ -8,6 +8,6 @@ async def test_system_certs_are_loaded(): rest_client = rest.RESTClientObject(Configuration()) # Calling an URL with a valid HTTPS cert - response = await rest_client.GET("https://google.fr") + response = await rest_client.request("GET", "https://google.fr") assert response.status == 200 diff --git a/tests/bdk/integration/e2e_test.py b/tests/bdk/integration/e2e_test.py index 7a8464a1..372e4497 100644 --- a/tests/bdk/integration/e2e_test.py +++ b/tests/bdk/integration/e2e_test.py @@ -82,12 +82,12 @@ async def test_bot_creates_stream_add_delete_user(bdk): await streams.add_member_to_room(test_user, room_id) members = await streams.list_room_members(room_id) # Then: user is present in the room - assert test_user in [m.id for m in members.value] + assert test_user in [m.id for m in members] # When: user is removed from the room await streams.remove_member_from_room(test_user, room_id) # Then: user is deleted from the room members_after_removal = await streams.list_room_members(room_id) - assert test_user not in [m.id for m in members_after_removal.value] + assert test_user not in [m.id for m in members_after_removal] @pytest.mark.asyncio diff --git a/tests/bdk/integration/helpers.py b/tests/bdk/integration/helpers.py index 8a6fa7df..7bf81edd 100644 --- a/tests/bdk/integration/helpers.py +++ b/tests/bdk/integration/helpers.py @@ -65,7 +65,7 @@ async def send_messages(messages, stream_id, since, uuid): async def get_test_messages(bdk, since, uuid): messages = await bdk.messages().list_messages(STREAM_ID, since=since) - cleaned_messages_text = [re.sub(r"<[^>]+>", " ", msg["message"]).strip() for msg in messages] + cleaned_messages_text = [re.sub(r"<[^>]+>", "", msg.message.rstrip()) for msg in messages] return list( filter( lambda msg: msg.startswith(uuid), diff --git a/tests/core/auth/bot_authenticator_cert_test.py b/tests/core/auth/bot_authenticator_cert_test.py index 599e87a1..3eedd49c 100644 --- a/tests/core/auth/bot_authenticator_cert_test.py +++ b/tests/core/auth/bot_authenticator_cert_test.py @@ -1,10 +1,9 @@ -from unittest.mock import AsyncMock, MagicMock +from unittest.mock import AsyncMock, MagicMock, patch import pytest from symphony.bdk.core.auth.bot_authenticator import BotAuthenticatorCert from symphony.bdk.core.auth.exception import AuthUnauthorizedError -from symphony.bdk.core.config.model.bdk_bot_config import BdkBotConfig from symphony.bdk.gen.api_client import ApiClient from symphony.bdk.gen.configuration import Configuration from symphony.bdk.gen.exceptions import ApiException @@ -16,51 +15,52 @@ def fixture_mocked_api_client(): def _create_api_client(): # We do this to have a new instance for each call api_client = MagicMock(ApiClient) - api_client.call_api = AsyncMock() api_client.configuration = Configuration() return api_client return _create_api_client -@pytest.fixture(name="config") -def fixture_config(): - bot_config = {"username": "test_bot", "privateKey": {"path": "path/to/private_key"}} - return BdkBotConfig(bot_config) - - @pytest.mark.asyncio async def test_bot_session_cert(mocked_api_client): - session_auth_client = mocked_api_client() - key_auth_client = mocked_api_client() + with patch("symphony.bdk.core.auth.bot_authenticator.CertificateAuthenticationApi") as cert_auth_api_class_mock: + session_auth_client = mocked_api_client() + key_auth_client = mocked_api_client() - session_auth_client.call_api.return_value = Token(token="session_token") - key_auth_client.call_api.return_value = Token(token="km_token") + cert_auth_api_instance_mock = MagicMock() + cert_auth_api_instance_mock.v1_authenticate_post = AsyncMock() + cert_auth_api_instance_mock.v1_authenticate_post.side_effect = [ + Token(token="session_token"), + Token(token="km_token"), + ] + cert_auth_api_class_mock.return_value = cert_auth_api_instance_mock - bot_authenticator = BotAuthenticatorCert( - session_auth_client, key_auth_client, minimal_retry_config() - ) - session_token = await bot_authenticator.retrieve_session_token() - km_token = await bot_authenticator.retrieve_key_manager_token() + bot_authenticator = BotAuthenticatorCert( + session_auth_client, key_auth_client, minimal_retry_config() + ) + session_token = await bot_authenticator.retrieve_session_token() + km_token = await bot_authenticator.retrieve_key_manager_token() - assert session_token == "session_token" - assert km_token == "km_token" + assert session_token == "session_token" + assert km_token == "km_token" @pytest.mark.asyncio async def test_api_exception_cert(mocked_api_client): - session_auth_client = mocked_api_client() - key_auth_client = mocked_api_client() + with patch("symphony.bdk.core.auth.bot_authenticator.CertificateAuthenticationApi") as cert_auth_api_class_mock: + session_auth_client = mocked_api_client() + key_auth_client = mocked_api_client() - session_auth_client.call_api.side_effect = ApiException(status=401) - key_auth_client.call_api.side_effect = ApiException(status=401) + cert_auth_api_instance_mock = MagicMock() + cert_auth_api_instance_mock.v1_authenticate_post = AsyncMock(side_effect=ApiException(status=401)) + cert_auth_api_class_mock.return_value = cert_auth_api_instance_mock - bot_authenticator = BotAuthenticatorCert( - session_auth_client, key_auth_client, minimal_retry_config() - ) + bot_authenticator = BotAuthenticatorCert( + session_auth_client, key_auth_client, minimal_retry_config() + ) - with pytest.raises(AuthUnauthorizedError): - await bot_authenticator.retrieve_session_token() + with pytest.raises(AuthUnauthorizedError): + await bot_authenticator.retrieve_session_token() - with pytest.raises(AuthUnauthorizedError): - await bot_authenticator.retrieve_key_manager_token() + with pytest.raises(AuthUnauthorizedError): + await bot_authenticator.retrieve_key_manager_token() diff --git a/tests/core/auth/bot_authenticator_rsa_test.py b/tests/core/auth/bot_authenticator_rsa_test.py index 91779e11..7623188f 100644 --- a/tests/core/auth/bot_authenticator_rsa_test.py +++ b/tests/core/auth/bot_authenticator_rsa_test.py @@ -31,21 +31,24 @@ def fixture_config(): @pytest.mark.asyncio async def test_bot_session_rsa(config, mocked_api_client): - with ( - patch( - "symphony.bdk.core.auth.bot_authenticator.create_signed_jwt", return_value="privateKey" - ), - patch( - "symphony.bdk.core.auth.bot_authenticator.generate_expiration_time", return_value=100 - ), - ): + with patch("symphony.bdk.core.auth.bot_authenticator.create_signed_jwt", return_value="privateKey"), \ + patch("symphony.bdk.core.auth.bot_authenticator.generate_expiration_time", return_value=100), \ + patch("symphony.bdk.core.auth.bot_authenticator.AuthenticationApi") as auth_api_class_mock: login_api_client = mocked_api_client() relay_api_client = mocked_api_client() - login_api_client.call_api.return_value = Token( + auth_api_instance_mock = MagicMock() + auth_api_instance_mock.pubkey_authenticate_post = AsyncMock() + session_token_obj = Token( authorization_token="auth_token", token="session_token", name="sessionToken" ) - relay_api_client.call_api.return_value = Token(token="km_token") + km_token_obj = Token(token="km_token") + auth_api_instance_mock.pubkey_authenticate_post.side_effect = [ + session_token_obj, + km_token_obj, + session_token_obj, + ] + auth_api_class_mock.return_value = auth_api_instance_mock bot_authenticator = BotAuthenticatorRsa( config, login_api_client, relay_api_client, minimal_retry_config() @@ -55,22 +58,20 @@ async def test_bot_session_rsa(config, mocked_api_client): auth_token, expire_at = await bot_authenticator.retrieve_session_token_object() assert session_token == "session_token" assert km_token == "km_token" - assert auth_token == Token( - authorization_token="auth_token", token="session_token", name="sessionToken" - ) + assert auth_token == session_token_obj assert expire_at == 100 @pytest.mark.asyncio async def test_api_exception_rsa(config, mocked_api_client): - with patch( - "symphony.bdk.core.auth.bot_authenticator.create_signed_jwt", return_value="privateKey" - ): + with patch("symphony.bdk.core.auth.bot_authenticator.create_signed_jwt", return_value="privateKey"), \ + patch("symphony.bdk.core.auth.bot_authenticator.AuthenticationApi") as auth_api_class_mock: login_api_client = mocked_api_client() relay_api_client = mocked_api_client() - login_api_client.call_api.side_effect = ApiException(status=401) - relay_api_client.call_api.side_effect = ApiException(status=401) + auth_api_instance_mock = MagicMock() + auth_api_instance_mock.pubkey_authenticate_post = AsyncMock(side_effect=ApiException(status=401)) + auth_api_class_mock.return_value = auth_api_instance_mock bot_authenticator = BotAuthenticatorRsa( config, login_api_client, relay_api_client, minimal_retry_config() diff --git a/tests/core/auth/ext_app_authenticator_test.py b/tests/core/auth/ext_app_authenticator_test.py index a61ece4c..15b333f3 100644 --- a/tests/core/auth/ext_app_authenticator_test.py +++ b/tests/core/auth/ext_app_authenticator_test.py @@ -8,10 +8,13 @@ ExtensionAppAuthenticatorRsa, ) from symphony.bdk.core.config.model.bdk_rsa_key_config import BdkRsaKeyConfig -from symphony.bdk.gen import ApiException +from symphony.bdk.gen.rest import ApiException from symphony.bdk.gen.auth_model.extension_app_authenticate_request import ( ExtensionAppAuthenticateRequest, ) +from symphony.bdk.gen.login_model.authenticate_extension_app_request import ( + AuthenticateExtensionAppRequest, +) from symphony.bdk.gen.login_model.extension_app_tokens import ExtensionAppTokens from symphony.bdk.gen.pod_model.pod_certificate import PodCertificate from tests.core.config import minimal_retry_config @@ -100,13 +103,10 @@ async def test_authenticate_and_retrieve_tokens(): ) mock_create_jwt.assert_called_once_with(key_config, app_id) - mock_authentication_api.v1_pubkey_app_authenticate_extension_app_post.assert_called_once() - - call_args = ( - mock_authentication_api.v1_pubkey_app_authenticate_extension_app_post.call_args.args[0] + expected_request = AuthenticateExtensionAppRequest(app_token=app_token, auth_token=signed_jwt) + mock_authentication_api.v1_pubkey_app_authenticate_extension_app_post.assert_called_once_with( + authenticate_request=expected_request ) - assert call_args.app_token == app_token - assert call_args.auth_token == signed_jwt @pytest.mark.asyncio diff --git a/tests/core/client/api_client_factory_test.py b/tests/core/client/api_client_factory_test.py index f6a33139..bd74b465 100644 --- a/tests/core/client/api_client_factory_test.py +++ b/tests/core/client/api_client_factory_test.py @@ -69,9 +69,7 @@ async def test_close_custom_host_configured(config): client_factory = ApiClientFactory(config) client_factory.get_client(custom_path) - assert client_factory._custom_clients[0].rest_client.pool_manager.closed is False - await client_factory.close_clients() - assert client_factory._custom_clients[0].rest_client.pool_manager.closed is True + assert client_factory._custom_clients[0].rest_client.pool_manager is None @pytest.mark.asyncio diff --git a/tests/core/client/trace_id_test.py b/tests/core/client/trace_id_test.py index 731efdec..959ce524 100644 --- a/tests/core/client/trace_id_test.py +++ b/tests/core/client/trace_id_test.py @@ -16,14 +16,14 @@ def setup_function(): def assert_args_except_trace_id_kept_as_is(input_args, actual_args): - assert actual_args[0:3] == input_args[0:3] + assert actual_args[0:1] == input_args[0:1] - if len(actual_args) >= 4: - assert X_TRACE_ID in actual_args[4] - assert {k: actual_args[4][k] for k in actual_args[4].keys() - {X_TRACE_ID}} == input_args[4] + if len(actual_args) >= 2: + assert X_TRACE_ID in actual_args[2] + assert {k: actual_args[2][k] for k in actual_args[2].keys() - {X_TRACE_ID}} == input_args[2] - if len(actual_args) >= 5: - assert actual_args[5:] == input_args[5:] + if len(actual_args) >= 3: + assert actual_args[3:] == input_args[3:] def test_empty_tracing_context(): @@ -60,7 +60,7 @@ def test_clear_trace_id(): @pytest.mark.asyncio async def test_add_x_trace_id_no_trace_id_set_args_length_too_short(): - args = ["a", 2, "b", 3] + args = ["a"] func_return_value = "value" func = AsyncMock() @@ -77,7 +77,7 @@ async def test_add_x_trace_id_no_trace_id_set_args_length_too_short(): @pytest.mark.asyncio async def test_add_x_trace_id_no_trace_id_set_args_length_long_enough(): - args = ["a", 2, "b", 3, {"key": "value"}, "c", 4] + args = ["a", 2, {"key": "value"}, "b", 3, "c", 4] func_return_value = "value" func = AsyncMock() @@ -91,12 +91,12 @@ async def test_add_x_trace_id_no_trace_id_set_args_length_long_enough(): actual_args = list(func.call_args.args) assert_args_except_trace_id_kept_as_is(args, actual_args) - assert len(actual_args[4][X_TRACE_ID]) == TRACE_ID_LENGTH + assert len(actual_args[2][X_TRACE_ID]) == TRACE_ID_LENGTH @pytest.mark.asyncio async def test_add_x_trace_id_trace_id_set_args_length_too_short(): - args = ["a", 2, "b", 3] + args = ["a"] func_return_value = "value" trace_id = "trace-id" @@ -114,7 +114,7 @@ async def test_add_x_trace_id_trace_id_set_args_length_too_short(): @pytest.mark.asyncio async def test_add_x_trace_id_trace_id_set_args_length_long_enough(): - args = ["a", 2, "b", 3, {"key": "value"}, "c", 4] + args = ["a", 2, {"key": "value"}, "b", 3, "c", 4] func_return_value = "value" trace_id = "trace-id" @@ -130,12 +130,12 @@ async def test_add_x_trace_id_trace_id_set_args_length_long_enough(): actual_args = list(func.call_args.args) assert_args_except_trace_id_kept_as_is(args, actual_args) - assert actual_args[4][X_TRACE_ID] == trace_id + assert actual_args[2][X_TRACE_ID] == trace_id @pytest.mark.asyncio async def test_add_x_trace_id_trace_id_set_several_calls(): - args = ["a", 2, "b", 3, {"key": "value"}, "c", 4] + args = ["a", 2, {"key": "value"}, "b", 3, "c", 4] trace_id = "trace-id" func = AsyncMock() @@ -144,8 +144,8 @@ async def test_add_x_trace_id_trace_id_set_several_calls(): await add_x_trace_id(func)(*deepcopy(args)) await add_x_trace_id(func)(*deepcopy(args)) - first_trace_id = func.call_args_list[0].args[4][X_TRACE_ID] - second_trace_id = func.call_args_list[1].args[4][X_TRACE_ID] + first_trace_id = func.call_args_list[0].args[2][X_TRACE_ID] + second_trace_id = func.call_args_list[1].args[2][X_TRACE_ID] assert first_trace_id == trace_id assert second_trace_id == trace_id @@ -153,15 +153,15 @@ async def test_add_x_trace_id_trace_id_set_several_calls(): @pytest.mark.asyncio async def test_add_x_trace_id_trace_id_not_set_several_calls(): - args = ["a", 2, "b", 3, {"key": "value"}, "c", 4] + args = ["a", 2, {"key": "value"}, "b", 3, "c", 4] func = AsyncMock() await add_x_trace_id(func)(*deepcopy(args)) await add_x_trace_id(func)(*deepcopy(args)) - first_trace_id = func.call_args_list[0].args[4][X_TRACE_ID] - second_trace_id = func.call_args_list[1].args[4][X_TRACE_ID] + first_trace_id = func.call_args_list[0].args[2][X_TRACE_ID] + second_trace_id = func.call_args_list[1].args[2][X_TRACE_ID] assert first_trace_id != second_trace_id assert len(first_trace_id) == TRACE_ID_LENGTH diff --git a/tests/core/retry/asyncio_test.py b/tests/core/retry/asyncio_test.py index b92baf9b..ebc5d635 100644 --- a/tests/core/retry/asyncio_test.py +++ b/tests/core/retry/asyncio_test.py @@ -4,7 +4,7 @@ import tenacity from symphony.bdk.core.retry import retry -from symphony.bdk.gen import ApiException +from symphony.bdk.gen.rest import ApiException from tests.core.config import minimal_retry_config_with_attempts from tests.core.retry import NoApiExceptionAfterCount, NoIOErrorAfterCount, retry_test_decorator diff --git a/tests/core/retry/strategy_test.py b/tests/core/retry/strategy_test.py index d2bc5449..96f9b512 100644 --- a/tests/core/retry/strategy_test.py +++ b/tests/core/retry/strategy_test.py @@ -7,7 +7,7 @@ import symphony.bdk.core.retry.strategy as strategy from symphony.bdk.core.auth.exception import AuthUnauthorizedError from symphony.bdk.core.retry import retry -from symphony.bdk.gen import ApiException +from symphony.bdk.gen.rest import ApiException from tests.core.config import minimal_retry_config_with_attempts from tests.core.retry import FixedChainedExceptions, NoApiExceptionAfterCount diff --git a/tests/core/service/application/application_service_test.py b/tests/core/service/application/application_service_test.py index a8db3d39..01af8b6d 100644 --- a/tests/core/service/application/application_service_test.py +++ b/tests/core/service/application/application_service_test.py @@ -1,3 +1,4 @@ +from typing import List from unittest.mock import AsyncMock, MagicMock import pytest @@ -8,11 +9,8 @@ from symphony.bdk.gen.pod_api.application_api import ApplicationApi from symphony.bdk.gen.pod_model.application_detail import ApplicationDetail from symphony.bdk.gen.pod_model.pod_app_entitlement import PodAppEntitlement -from symphony.bdk.gen.pod_model.pod_app_entitlement_list import PodAppEntitlementList from symphony.bdk.gen.pod_model.user_app_entitlement import UserAppEntitlement -from symphony.bdk.gen.pod_model.user_app_entitlement_list import UserAppEntitlementList from symphony.bdk.gen.pod_model.user_app_entitlement_patch import UserAppEntitlementPatch -from symphony.bdk.gen.pod_model.user_app_entitlements_patch_list import UserAppEntitlementsPatchList from tests.core.config import minimal_retry_config from tests.utils.resource_utils import get_deserialized_object_from_resource @@ -114,7 +112,7 @@ async def test_list_application_entitlements(app_entitlement_api, application_se app_entitlement_api.v1_admin_app_entitlement_list_get = AsyncMock() app_entitlement_api.v1_admin_app_entitlement_list_get.return_value = ( get_deserialized_object_from_resource( - PodAppEntitlementList, "application/list_app_entitlements.json" + List[PodAppEntitlement], "application/list_app_entitlements.json" ) ) @@ -133,7 +131,7 @@ async def test_update_application_entitlements(app_entitlement_api, application_ app_entitlement_api.v1_admin_app_entitlement_list_post = AsyncMock() app_entitlement_api.v1_admin_app_entitlement_list_post.return_value = ( get_deserialized_object_from_resource( - PodAppEntitlementList, "application/update_app_entitlements.json" + List[PodAppEntitlement], "application/update_app_entitlements.json" ) ) @@ -149,7 +147,7 @@ async def test_update_application_entitlements(app_entitlement_api, application_ ) app_entitlement_api.v1_admin_app_entitlement_list_post.assert_called_with( - session_token="session_token", payload=PodAppEntitlementList(value=[pod_app_entitlement]) + payload=[pod_app_entitlement], session_token="session_token" ) assert len(pod_app_entitlements) == 1 @@ -161,7 +159,7 @@ async def test_list_user_applications(app_entitlement_api, application_service): app_entitlement_api.v1_admin_user_uid_app_entitlement_list_get = AsyncMock() app_entitlement_api.v1_admin_user_uid_app_entitlement_list_get.return_value = ( get_deserialized_object_from_resource( - UserAppEntitlementList, "application/list_user_apps.json" + List[UserAppEntitlement], "application/list_user_apps.json" ) ) @@ -180,7 +178,7 @@ async def test_update_user_applications(app_entitlement_api, application_service app_entitlement_api.v1_admin_user_uid_app_entitlement_list_post = AsyncMock() app_entitlement_api.v1_admin_user_uid_app_entitlement_list_post.return_value = ( get_deserialized_object_from_resource( - UserAppEntitlementList, "application/list_user_apps.json" + List[UserAppEntitlement], "application/list_user_apps.json" ) ) @@ -193,7 +191,7 @@ async def test_update_user_applications(app_entitlement_api, application_service app_entitlement_api.v1_admin_user_uid_app_entitlement_list_post.assert_called_with( session_token="session_token", uid=1234, - payload=UserAppEntitlementList(value=[user_app_entitlement]), + payload=[user_app_entitlement], ) assert len(user_app_entitlements) == 3 @@ -205,7 +203,7 @@ async def test_patch_user_applications(app_entitlement_api, application_service) app_entitlement_api.v1_admin_user_uid_app_entitlement_list_patch = AsyncMock() app_entitlement_api.v1_admin_user_uid_app_entitlement_list_patch.return_value = ( get_deserialized_object_from_resource( - UserAppEntitlementList, "application/list_user_apps.json" + List[UserAppEntitlementPatch], "application/list_user_apps_str.json" ) ) @@ -220,7 +218,7 @@ async def test_patch_user_applications(app_entitlement_api, application_service) app_entitlement_api.v1_admin_user_uid_app_entitlement_list_patch.assert_called_with( session_token="session_token", uid=1234, - payload=UserAppEntitlementsPatchList(value=[user_app_entitlement_patch]), + payload=[user_app_entitlement_patch], ) assert len(user_app_patched_entitlements) == 3 diff --git a/tests/core/service/connection/connection_service_test.py b/tests/core/service/connection/connection_service_test.py index b39f6718..91ca0158 100644 --- a/tests/core/service/connection/connection_service_test.py +++ b/tests/core/service/connection/connection_service_test.py @@ -1,3 +1,4 @@ +from typing import List from unittest.mock import AsyncMock, MagicMock import pytest @@ -7,7 +8,6 @@ from symphony.bdk.core.service.connection.model.connection_status import ConnectionStatus from symphony.bdk.gen.pod_api.connection_api import ConnectionApi from symphony.bdk.gen.pod_model.user_connection import UserConnection -from symphony.bdk.gen.pod_model.user_connection_list import UserConnectionList from symphony.bdk.gen.pod_model.user_connection_request import UserConnectionRequest from tests.core.config import minimal_retry_config from tests.utils.resource_utils import deserialize_object @@ -52,7 +52,7 @@ async def test_get_connection(connection_api, connection_service): async def test_list_connections(connection_api, connection_service): connection_api.v1_connection_list_get = AsyncMock() connection_api.v1_connection_list_get.return_value = deserialize_object( - UserConnectionList, + List[UserConnection], "[" " {" ' "userId": 7078106126503,' diff --git a/tests/core/service/datafeed/datafeed_loop_v1_test.py b/tests/core/service/datafeed/datafeed_loop_v1_test.py index 07678f55..7c995d67 100644 --- a/tests/core/service/datafeed/datafeed_loop_v1_test.py +++ b/tests/core/service/datafeed/datafeed_loop_v1_test.py @@ -37,12 +37,6 @@ SLEEP_SECONDS = 0.0001 - -class EventsMock: - def __init__(self, events): - self.value = events - - @pytest.fixture(name="config") def fixture_config(): return BdkConfigLoader.load_from_file(get_config_resource_filepath("config.yaml")) @@ -73,7 +67,7 @@ def fixture_message_sent(initiator_username): @pytest.fixture(name="message_sent_event") def fixture_message_sent_event(message_sent): - return EventsMock([message_sent]) + return [message_sent] @pytest.fixture(name="read_df_side_effect") @@ -169,16 +163,9 @@ async def test_read_datafeed_none_list(datafeed_loop_v1, datafeed_api): assert await datafeed_loop_v1._read_datafeed() == [] -@pytest.mark.asyncio -async def test_read_datafeed_no_value(datafeed_loop_v1, datafeed_api): - datafeed_api.v4_datafeed_id_read_get.return_value = EventsMock(None) - - assert await datafeed_loop_v1._read_datafeed() == [] - - @pytest.mark.asyncio async def test_read_datafeed_empty_list(datafeed_loop_v1, datafeed_api): - datafeed_api.v4_datafeed_id_read_get.return_value = EventsMock([]) + datafeed_api.v4_datafeed_id_read_get.return_value = [] assert await datafeed_loop_v1._read_datafeed() == [] @@ -188,7 +175,7 @@ async def test_read_datafeed_non_empty_list( datafeed_loop_v1, datafeed_api, message_sent ): events = [message_sent] - datafeed_api.v4_datafeed_id_read_get.return_value = EventsMock(events) + datafeed_api.v4_datafeed_id_read_get.return_value = events assert await datafeed_loop_v1._read_datafeed() == events diff --git a/tests/core/service/datafeed/datafeed_loop_v2_test.py b/tests/core/service/datafeed/datafeed_loop_v2_test.py index f07d0b77..5061de36 100644 --- a/tests/core/service/datafeed/datafeed_loop_v2_test.py +++ b/tests/core/service/datafeed/datafeed_loop_v2_test.py @@ -17,7 +17,8 @@ from symphony.bdk.core.service.datafeed.real_time_event_listener import ( RealTimeEventListener, ) -from symphony.bdk.gen import ApiClient, ApiException +from symphony.bdk.gen.rest import ApiException +from symphony.bdk.gen.api_client import ApiClient from symphony.bdk.gen.agent_api.datafeed_api import DatafeedApi from symphony.bdk.gen.agent_model.ack_id import AckId from symphony.bdk.gen.agent_model.v4_event import V4Event diff --git a/tests/core/service/health/health_service_test.py b/tests/core/service/health/health_service_test.py index a2defd64..4ebe6a9d 100644 --- a/tests/core/service/health/health_service_test.py +++ b/tests/core/service/health/health_service_test.py @@ -3,7 +3,7 @@ import pytest from symphony.bdk.core.service.health.health_service import HealthService -from symphony.bdk.gen import ApiException +from symphony.bdk.gen.rest import ApiException from symphony.bdk.gen.agent_api.signals_api import SignalsApi from symphony.bdk.gen.agent_api.system_api import SystemApi from symphony.bdk.gen.agent_model.agent_info import AgentInfo diff --git a/tests/core/service/message/message_service_test.py b/tests/core/service/message/message_service_test.py index 27ea9497..b933b182 100644 --- a/tests/core/service/message/message_service_test.py +++ b/tests/core/service/message/message_service_test.py @@ -1,5 +1,6 @@ import json -from unittest.mock import AsyncMock, MagicMock +from typing import List +from unittest.mock import AsyncMock, MagicMock, PropertyMock import pytest @@ -11,11 +12,10 @@ ) from symphony.bdk.gen.agent_api.attachments_api import AttachmentsApi from symphony.bdk.gen.agent_model.message_search_query import MessageSearchQuery -from symphony.bdk.gen.agent_model.v4_import_response_list import V4ImportResponseList +from symphony.bdk.gen.agent_model.v4_import_response import V4ImportResponse from symphony.bdk.gen.agent_model.v4_imported_message import V4ImportedMessage from symphony.bdk.gen.agent_model.v4_message import V4Message from symphony.bdk.gen.agent_model.v4_message_blast_response import V4MessageBlastResponse -from symphony.bdk.gen.agent_model.v4_message_list import V4MessageList from symphony.bdk.gen.api_client import ApiClient, Configuration from symphony.bdk.gen.pod_api.default_api import DefaultApi from symphony.bdk.gen.pod_api.message_api import MessageApi @@ -26,17 +26,27 @@ from symphony.bdk.gen.pod_model.message_receipt_detail_response import MessageReceiptDetailResponse from symphony.bdk.gen.pod_model.message_status import MessageStatus from symphony.bdk.gen.pod_model.message_suppression_response import MessageSuppressionResponse -from symphony.bdk.gen.pod_model.stream_attachment_response import StreamAttachmentResponse -from symphony.bdk.gen.pod_model.string_list import StringList +from symphony.bdk.gen.pod_model.stream_attachment_item import StreamAttachmentItem from tests.core.config import minimal_retry_config from tests.utils.resource_utils import deserialize_object, get_deserialized_object_from_resource @pytest.fixture(name="auth_session") def fixture_auth_session(): - auth_session = AuthSession(None) - auth_session.session_token = "session_token" - auth_session.key_manager_token = "km_token" + auth_session = MagicMock(spec=AuthSession) + + async def get_session_token(): + return "session_token" + + async def get_km_token(): + return "km_token" + + # The session_token and key_manager_token properties on the real AuthSession + # return a coroutine. We need to mock them to return a new coroutine on each + # access to avoid "cannot reuse already awaited coroutine" errors in paginated calls. + type(auth_session).session_token = PropertyMock(side_effect=get_session_token) + type(auth_session).key_manager_token = PropertyMock(side_effect=get_km_token) + return auth_session @@ -65,23 +75,46 @@ def fixture_message_service(mocked_api_client, auth_session): @pytest.mark.asyncio -async def test_list_messages(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - V4MessageList, "message_response/list_messages.json" +async def test_list_messages(message_service): + return_object = get_deserialized_object_from_resource( + List[V4Message], "message_response/list_messages.json" ) - messages_list = await message_service.list_messages("stream_id") + messages_api = message_service._messages_api + messages_api.v4_stream_sid_message_get = AsyncMock(return_value=return_object) + stream_id = "stream_id" + messages_list = await message_service.list_messages(stream_id) + + messages_api.v4_stream_sid_message_get.assert_called_once_with( + sid=stream_id, + since=0, + session_token="session_token", + key_manager_token="km_token", + skip=0, + limit=50, + ) assert len(messages_list) == 1 assert messages_list[0].message_id == "test-message1" @pytest.mark.asyncio -async def test_send_message(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( +async def test_send_message(message_service): + return_object = get_deserialized_object_from_resource( V4Message, "message_response/message.json" ) - message = await message_service.send_message("stream_id", "test_message") + messages_api = message_service._messages_api + messages_api.v4_stream_sid_multi_attachment_message_create_post = AsyncMock(return_value=return_object) + stream_id = "stream_id" + message_content = "test_message" + message = await message_service.send_message(stream_id, message_content) + + messages_api.v4_stream_sid_multi_attachment_message_create_post.assert_called_once() + call_kwargs = messages_api.v4_stream_sid_multi_attachment_message_create_post.call_args.kwargs + assert call_kwargs["sid"] == stream_id + assert call_kwargs["message"] == f"{message_content}" + assert call_kwargs["session_token"] == "session_token" + assert call_kwargs["key_manager_token"] == "km_token" assert message.message_id == "-AANBHKtUC-2q6_0WSjBGX___pHnSfBKdA" assert message.user.user_id == 7078106482890 @@ -160,14 +193,29 @@ async def test_send_complex_message(message_service): @pytest.mark.asyncio -async def test_blast_message(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - V4MessageBlastResponse, "message_response/blast_message.json" - ) +async def test_blast_message(message_service): + # Construct the return object manually to avoid deserialization errors from the JSON file. + return_object = V4MessageBlastResponse( + messages=[ + V4Message(message_id="-AANBHKtUC-2q6_0WSjBGX___pHnSfBKdA-1"), + V4Message(message_id="-AANBHKtUC-2q6_0WSjBGX___pHnSfBKdA-2"), + ], + errors={} + ) + # Correctly mock the high-level API method + messages_api = message_service._messages_api + messages_api.v4_multi_attachment_message_blast_post = AsyncMock(return_value=return_object) + + stream_ids = ["stream_id1", "stream_id2"] + message_content = "test_message" blast_message = await message_service.blast_message( - ["stream_id1", "stream_id2"], "test_message" + stream_ids, message_content ) + messages_api.v4_multi_attachment_message_blast_post.assert_called_once() + call_kwargs = messages_api.v4_multi_attachment_message_blast_post.call_args.kwargs + assert call_kwargs["sids"] == stream_ids + assert call_kwargs["message"] == f"{message_content}" assert len(blast_message.messages) == 2 assert blast_message.messages[0].message_id == "-AANBHKtUC-2q6_0WSjBGX___pHnSfBKdA-1" assert blast_message.messages[1].message_id == "-AANBHKtUC-2q6_0WSjBGX___pHnSfBKdA-2" @@ -245,9 +293,9 @@ async def test_blast_complex_message(message_service): @pytest.mark.asyncio -async def test_import_message(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = deserialize_object( - V4ImportResponseList, +async def test_import_message(message_service): + return_object = deserialize_object( + List[V4ImportResponse], "[" " {" ' "messageId": "FjSY1y3L", ' @@ -256,6 +304,7 @@ async def test_import_message(mocked_api_client, message_service): " }" "]", ) + message_service._messages_api.v4_message_import_post = AsyncMock(return_value=return_object) import_response = await message_service.import_messages( [ @@ -275,8 +324,8 @@ async def test_import_message(mocked_api_client, message_service): @pytest.mark.asyncio -async def test_get_attachment(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = "attachment-string" +async def test_get_attachment(message_service): + message_service._attachment_api.v1_stream_sid_attachment_get = AsyncMock(return_value="attachment-string") attachment = await message_service.get_attachment("stream-id", "message-id", "attachment-id") @@ -284,10 +333,12 @@ async def test_get_attachment(mocked_api_client, message_service): @pytest.mark.asyncio -async def test_suppress_message(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( +async def test_suppress_message(message_service): + return_object = get_deserialized_object_from_resource( MessageSuppressionResponse, "message_response/supress_message.json" ) + message_service._message_suppression_api.v1_admin_messagesuppression_id_suppress_post = AsyncMock( + return_value=return_object) suppress_response = await message_service.suppress_message("test-message-id") assert suppress_response.message_id == "test-message-id" @@ -295,11 +346,11 @@ async def test_suppress_message(mocked_api_client, message_service): @pytest.mark.asyncio -async def test_get_message_status(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( +async def test_get_message_status(message_service): + return_object = get_deserialized_object_from_resource( MessageStatus, "message_response/message_status.json" ) - + message_service._message_api.v1_message_mid_status_get = AsyncMock(return_value=return_object) message_status = await message_service.get_message_status("test-message-id") assert message_status.author.user_id == "7078106103901" @@ -308,10 +359,11 @@ async def test_get_message_status(mocked_api_client, message_service): @pytest.mark.asyncio -async def test_get_attachment_types(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = deserialize_object( - StringList, '[ ".bmp", ".doc", ".png", ".mpeg"]' +async def test_get_attachment_types(message_service): + return_object = deserialize_object( + List[str], '[ ".bmp", ".doc", ".png", ".mpeg"]' ) + message_service._pod_api.v1_files_allowed_types_get = AsyncMock(return_value=return_object) attachment_types = await message_service.get_attachment_types() @@ -320,11 +372,11 @@ async def test_get_attachment_types(mocked_api_client, message_service): @pytest.mark.asyncio -async def test_get_message(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( +async def test_get_message(message_service): + return_object = get_deserialized_object_from_resource( V4Message, "message_response/message.json" ) - + message_service._messages_api.v1_message_id_get = AsyncMock(return_value=return_object) message = await message_service.get_message("-AANBHKtUC-2q6_0WSjBGX___pHnSfBKdA") assert message.message_id == "-AANBHKtUC-2q6_0WSjBGX___pHnSfBKdA" @@ -333,11 +385,11 @@ async def test_get_message(mocked_api_client, message_service): @pytest.mark.asyncio -async def test_list_attachments(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - StreamAttachmentResponse, "message_response/list_attachments.json" +async def test_list_attachments(message_service): + return_object = get_deserialized_object_from_resource( + List[StreamAttachmentItem], "message_response/list_attachments.json" ) - + message_service._streams_api.v1_streams_sid_attachments_get = AsyncMock(return_value=return_object) attachments = await message_service.list_attachments("stream_id") assert len(attachments) == 2 @@ -346,11 +398,11 @@ async def test_list_attachments(mocked_api_client, message_service): @pytest.mark.asyncio -async def test_message_receipts(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( +async def test_message_receipts(message_service): + return_object = get_deserialized_object_from_resource( MessageReceiptDetailResponse, "message_response/message_receipts.json" ) - + message_service._default_api.v1_admin_messages_message_id_receipts_get = AsyncMock(return_value=return_object) message_receipts = await message_service.list_message_receipts("test-message-id") assert message_receipts.creator.id == 7215545058329 @@ -359,11 +411,12 @@ async def test_message_receipts(mocked_api_client, message_service): @pytest.mark.asyncio -async def test_get_message_relationships(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( +async def test_get_message_relationships(message_service): + return_object = get_deserialized_object_from_resource( MessageMetadataResponse, "message_response/message_relationships.json" ) - + message_service._default_api.v1_admin_messages_message_id_metadata_relationships_get = AsyncMock( + return_value=return_object) message_relationships = await message_service.get_message_relationships( "TYgOZ65dVsu3SeK7u2YdfH///o6fzBu" ) @@ -374,12 +427,19 @@ async def test_get_message_relationships(mocked_api_client, message_service): @pytest.mark.asyncio -async def test_search_messages_with_hashtag(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - V4MessageList, "message_response/list_messages.json" +async def test_search_messages_with_hashtag(message_service): + return_object = get_deserialized_object_from_resource( + List[V4Message], "message_response/list_messages.json" ) + messages_api = message_service._messages_api + messages_api.v1_message_search_post = AsyncMock(return_value=return_object) + + query = MessageSearchQuery(hashtag="tag") + messages = await message_service.search_messages(query) - messages = await message_service.search_messages(MessageSearchQuery(hashtag="tag")) + messages_api.v1_message_search_post.assert_called_once() + call_kwargs = messages_api.v1_message_search_post.call_args.kwargs + assert call_kwargs["query"] == query assert len(messages) == 1 assert messages[0].message_id == "test-message1" @@ -387,46 +447,50 @@ async def test_search_messages_with_hashtag(mocked_api_client, message_service): @pytest.mark.asyncio @pytest.mark.parametrize("stream_type", ["CHAT", "IM", "MIM", "ROOM", "POST"]) async def test_search_messages_with_valid_stream_type( - mocked_api_client, message_service, stream_type + message_service, stream_type ): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - V4MessageList, "message_response/list_messages.json" + return_object = get_deserialized_object_from_resource( + List[V4Message], "message_response/list_messages.json" ) + messages_api = message_service._messages_api + messages_api.v1_message_search_post = AsyncMock(return_value=return_object) - messages = await message_service.search_messages(MessageSearchQuery(stream_type=stream_type)) + query = MessageSearchQuery(stream_type=stream_type) + messages = await message_service.search_messages(query) + + messages_api.v1_message_search_post.assert_called_once() + call_kwargs = messages_api.v1_message_search_post.call_args.kwargs + assert call_kwargs["query"] == query assert len(messages) == 1 assert messages[0].message_id == "test-message1" @pytest.mark.asyncio -async def test_search_messages_with_invalid_stream_type(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - V4MessageList, "message_response/list_messages.json" - ) - +async def test_search_messages_with_invalid_stream_type(message_service): with pytest.raises(ValueError): await message_service.search_messages(MessageSearchQuery(stream_type="invalid")) @pytest.mark.asyncio -async def test_search_messages_with_text_and_sid(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - V4MessageList, "message_response/list_messages.json" +async def test_search_messages_with_text_and_sid(message_service): + return_object = get_deserialized_object_from_resource( + List[V4Message], "message_response/list_messages.json" ) + messages_api = message_service._messages_api + messages_api.v1_message_search_post = AsyncMock(return_value=return_object) - messages = await message_service.search_messages( - MessageSearchQuery(text="some text", stream_id="sid") - ) + query = MessageSearchQuery(text="some text", stream_id="sid") + messages = await message_service.search_messages(query) + + messages_api.v1_message_search_post.assert_called_once() + call_kwargs = messages_api.v1_message_search_post.call_args.kwargs + assert call_kwargs["query"] == query assert len(messages) == 1 assert messages[0].message_id == "test-message1" @pytest.mark.asyncio -async def test_search_messages_with_text_and_no_sid(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - V4MessageList, "message_response/list_messages.json" - ) - +async def test_search_messages_with_text_and_no_sid(message_service): with pytest.raises(ValueError): await message_service.search_messages(MessageSearchQuery(text="some text")) @@ -434,15 +498,20 @@ async def test_search_messages_with_text_and_no_sid(mocked_api_client, message_s @pytest.mark.asyncio @pytest.mark.parametrize("stream_type", ["CHAT", "IM", "MIM", "ROOM", "POST"]) async def test_search_messages_with_stream_type_text_and_sid( - mocked_api_client, message_service, stream_type + message_service, stream_type ): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - V4MessageList, "message_response/list_messages.json" + return_object = get_deserialized_object_from_resource( + List[V4Message], "message_response/list_messages.json" ) + messages_api = message_service._messages_api + messages_api.v1_message_search_post = AsyncMock(return_value=return_object) - messages = await message_service.search_messages( - MessageSearchQuery(text="some text", stream_id="sid", stream_type=stream_type) - ) + query = MessageSearchQuery(text="some text", stream_id="sid", stream_type=stream_type) + messages = await message_service.search_messages(query) + + messages_api.v1_message_search_post.assert_called_once() + call_kwargs = messages_api.v1_message_search_post.call_args.kwargs + assert call_kwargs["query"] == query assert len(messages) == 1 assert messages[0].message_id == "test-message1" @@ -450,12 +519,8 @@ async def test_search_messages_with_stream_type_text_and_sid( @pytest.mark.asyncio @pytest.mark.parametrize("stream_type", ["CHAT", "IM", "MIM", "ROOM", "POST"]) async def test_search_messages_with_stream_type_text_and_no_sid( - mocked_api_client, message_service, stream_type + message_service, stream_type ): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - V4MessageList, "message_response/list_messages.json" - ) - with pytest.raises(ValueError): await message_service.search_messages( MessageSearchQuery(text="some text", stream_type=stream_type) @@ -463,11 +528,12 @@ async def test_search_messages_with_stream_type_text_and_no_sid( @pytest.mark.asyncio -async def test_search_all_messages(mocked_api_client, message_service): - mocked_api_client.call_api.side_effect = [ - get_deserialized_object_from_resource(V4MessageList, "message_response/list_messages.json"), - V4MessageList(value=[]), - ] +async def test_search_all_messages(message_service): + messages_api = message_service._messages_api + messages_api.v1_message_search_post = AsyncMock(side_effect=[ + get_deserialized_object_from_resource(List[V4Message], "message_response/list_messages.json"), + [], + ]) chunk_size = 1 message_generator = await message_service.search_all_messages( @@ -477,14 +543,15 @@ async def test_search_all_messages(mocked_api_client, message_service): assert len(messages) == 1 assert messages[0].message_id == "test-message1" - assert mocked_api_client.call_api.call_count == 2 + assert messages_api.v1_message_search_post.call_count == 2 @pytest.mark.asyncio -async def test_update_message(mocked_api_client, message_service): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( +async def test_update_message(message_service): + return_object = get_deserialized_object_from_resource( V4Message, "message_response/update_message.json" ) + message_service._messages_api.v4_stream_sid_message_mid_update_post = AsyncMock(return_value=return_object) message = await message_service.update_message( "stream_id", "message_id", "test_message", "data", "version" ) diff --git a/tests/core/service/presence/presence_service_test.py b/tests/core/service/presence/presence_service_test.py index 2ec98cc2..f2e05bf1 100644 --- a/tests/core/service/presence/presence_service_test.py +++ b/tests/core/service/presence/presence_service_test.py @@ -1,14 +1,14 @@ +from typing import List from unittest.mock import AsyncMock, MagicMock import pytest from symphony.bdk.core.auth.auth_session import AuthSession from symphony.bdk.core.service.presence.presence_service import PresenceService, PresenceStatus -from symphony.bdk.gen import ApiException +from symphony.bdk.gen.rest import ApiException from symphony.bdk.gen.pod_api.presence_api import PresenceApi from symphony.bdk.gen.pod_model.string_id import StringId from symphony.bdk.gen.pod_model.v2_presence import V2Presence -from symphony.bdk.gen.pod_model.v2_presence_list import V2PresenceList from symphony.bdk.gen.pod_model.v2_presence_status import V2PresenceStatus from symphony.bdk.gen.pod_model.v2_user_presence import V2UserPresence from tests.core.config import minimal_retry_config @@ -66,7 +66,7 @@ async def test_get_presence_failed(presence_service, mocked_presence_api_client) @pytest.mark.asyncio async def test_get_all_presence(presence_service, mocked_presence_api_client): mocked_presence_api_client.v2_users_presence_get.return_value = deserialize_object( - V2PresenceList, + List[V2Presence], "[" " {" ' "category":"AVAILABLE",' @@ -186,7 +186,7 @@ async def test_create_presence_feed_failed(presence_service, mocked_presence_api @pytest.mark.asyncio async def test_read_presence_feed(presence_service, mocked_presence_api_client): mocked_presence_api_client.v1_presence_feed_feed_id_read_get.return_value = deserialize_object( - V2PresenceList, + List[V2Presence], "[" " {" ' "category":"AVAILABLE",' diff --git a/tests/core/service/signal/signal_service_test.py b/tests/core/service/signal/signal_service_test.py index b69e176e..8eb159d2 100644 --- a/tests/core/service/signal/signal_service_test.py +++ b/tests/core/service/signal/signal_service_test.py @@ -1,3 +1,4 @@ +from typing import List from unittest.mock import AsyncMock, MagicMock import pytest @@ -9,7 +10,6 @@ from symphony.bdk.gen.agent_model.channel_subscriber_response import ChannelSubscriberResponse from symphony.bdk.gen.agent_model.channel_subscription_response import ChannelSubscriptionResponse from symphony.bdk.gen.agent_model.signal import Signal -from symphony.bdk.gen.agent_model.signal_list import SignalList from tests.core.config import minimal_retry_config from tests.utils.resource_utils import get_deserialized_object_from_resource @@ -37,25 +37,24 @@ def fixture_signal_service(signals_api, auth_session): async def test_list_signals(signals_api, signal_service): signals_api.v1_signals_list_get = AsyncMock() signals_api.v1_signals_list_get.return_value = get_deserialized_object_from_resource( - SignalList, "signal/list_signals.json" + List[Signal], "signal/list_signals.json" ) signals = await signal_service.list_signals() - signal_list = signals.value signals_api.v1_signals_list_get.assert_called_with( skip=0, limit=50, session_token="session_token", key_manager_token="km_token" ) - assert len(signal_list) == 2 - assert signal_list[0].id == "signal_id1" + assert len(signals) == 2 + assert signals[0].id == "signal_id1" @pytest.mark.asyncio async def test_list_all_signals(signals_api, signal_service): signals_api.v1_signals_list_get = AsyncMock() signals_api.v1_signals_list_get.return_value = get_deserialized_object_from_resource( - SignalList, "signal/list_signals.json" + List[Signal], "signal/list_signals.json" ) signal_list_gen = await signal_service.list_all_signals() @@ -73,11 +72,10 @@ async def test_list_all_signals(signals_api, signal_service): async def test_list_signals_with_skip_and_limit(signals_api, signal_service): signals_api.v1_signals_list_get = AsyncMock() signals_api.v1_signals_list_get.return_value = get_deserialized_object_from_resource( - SignalList, "signal/list_signals.json" + List[Signal], "signal/list_signals.json" ) signal_list = await signal_service.list_signals(3, 30) - signal_list = signal_list.value signals_api.v1_signals_list_get.assert_called_with( skip=3, limit=30, session_token="session_token", key_manager_token="km_token" diff --git a/tests/core/service/stream/stream_service_test.py b/tests/core/service/stream/stream_service_test.py index d9ae96d9..b997d5a4 100644 --- a/tests/core/service/stream/stream_service_test.py +++ b/tests/core/service/stream/stream_service_test.py @@ -1,3 +1,4 @@ +from typing import List from unittest.mock import AsyncMock, MagicMock, Mock import pytest @@ -10,13 +11,12 @@ from symphony.bdk.gen.agent_model.v2_message import V2Message from symphony.bdk.gen.pod_api.room_membership_api import RoomMembershipApi from symphony.bdk.gen.pod_api.streams_api import StreamsApi -from symphony.bdk.gen.pod_model.membership_list import MembershipList +from symphony.bdk.gen.pod_model.member_info import MemberInfo from symphony.bdk.gen.pod_model.room_detail import RoomDetail from symphony.bdk.gen.pod_model.stream import Stream +from symphony.bdk.gen.pod_model.stream_attributes import StreamAttributes from symphony.bdk.gen.pod_model.stream_filter import StreamFilter -from symphony.bdk.gen.pod_model.stream_list import StreamList from symphony.bdk.gen.pod_model.user_id import UserId -from symphony.bdk.gen.pod_model.user_id_list import UserIdList from symphony.bdk.gen.pod_model.v1_im_attributes import V1IMAttributes from symphony.bdk.gen.pod_model.v1_im_detail import V1IMDetail from symphony.bdk.gen.pod_model.v2_admin_stream_filter import V2AdminStreamFilter @@ -78,9 +78,10 @@ def fixture_stream_service(streams_api, room_membership_api, share_api, auth_ses @pytest.mark.asyncio async def test_get_stream(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V2StreamAttributes, "stream/get_stream.json" ) + streams_api.v2_streams_sid_info_get = AsyncMock(return_value=return_object) stream_id = "stream_id" stream_attributes = await stream_service.get_stream(stream_id) @@ -95,9 +96,10 @@ async def test_get_stream(mocked_api_client, stream_service, streams_api): @pytest.mark.asyncio async def test_list_streams(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - StreamList, "stream/list_streams.json" + return_object = get_deserialized_object_from_resource( + List[StreamAttributes], "stream/list_streams.json" ) + streams_api.v1_streams_list_post = AsyncMock(return_value=return_object) stream_filter = StreamFilter() skip = 1 @@ -108,19 +110,20 @@ async def test_list_streams(mocked_api_client, stream_service, streams_api): streams_api.v1_streams_list_post.assert_called_once_with( filter=stream_filter, skip=skip, limit=limit, session_token=SESSION_TOKEN ) - assert len(streams.value) == 2 - assert streams.value[0].id == "ouAS1QXEHtIhXdZq4NzJBX___oscpQFcdA" - assert streams.value[0].room_attributes.name == "Room APP-3033" - assert streams.value[1].id == "z22OMRPxSdRFBfH_oojGkn___orihaxrdA" - assert streams.value[1].room_attributes.name == "Test BDK" + assert len(streams) == 2 + assert streams[0].id == "ouAS1QXEHtIhXdZq4NzJBX___oscpQFcdA" + assert streams[0].room_attributes.name == "Room APP-3033" + assert streams[1].id == "z22OMRPxSdRFBfH_oojGkn___orihaxrdA" + assert streams[1].room_attributes.name == "Test BDK" @pytest.mark.asyncio async def test_list_all_streams(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - StreamList, "stream/list_streams.json" + return_object = get_deserialized_object_from_resource( + List[StreamAttributes], "stream/list_streams.json" ) - + streams_api.v1_streams_list_post = AsyncMock(return_value=return_object) + stream_filter = StreamFilter() limit = 4 @@ -165,10 +168,11 @@ async def test_remove_member_from_room(stream_service, room_membership_api): @pytest.mark.asyncio async def test_share(mocked_api_client, stream_service, share_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V2Message, "stream/share_article.json" ) - + share_api.v3_stream_sid_share_post = AsyncMock(return_value=return_object) + stream_id = "stream_id" share_content = ShareContent() message = await stream_service.share(stream_id, share_content) @@ -211,25 +215,27 @@ async def test_demote_owner(stream_service, room_membership_api): @pytest.mark.asyncio async def test_create_im(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( Stream, "stream/create_im.json" ) - + streams_api.v1_im_create_post = AsyncMock(return_value=return_object) + user_id = 12334 stream = await stream_service.create_im(user_id) streams_api.v1_im_create_post.assert_called_once_with( - uid_list=UserIdList(value=[user_id]), session_token=SESSION_TOKEN + uid_list=[user_id], session_token=SESSION_TOKEN ) assert stream.id == "-M8s5WG7K8lAP7cpIiuyTH___oh4zK8EdA" @pytest.mark.asyncio async def test_create_room(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V3RoomDetail, "stream/create_room.json" ) - + streams_api.v3_room_create_post = AsyncMock(return_value=return_object) + room_attributes = V3RoomAttributes() room_details = await stream_service.create_room(room_attributes) @@ -242,10 +248,11 @@ async def test_create_room(mocked_api_client, stream_service, streams_api): @pytest.mark.asyncio async def test_search_rooms(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V3RoomSearchResults, "stream/search_rooms.json" ) - + streams_api.v3_room_search_post = AsyncMock(return_value=return_object) + search_criteria = V2RoomSearchCriteria(query="query") skip = 1 limit = 2 @@ -265,10 +272,11 @@ async def test_search_rooms(mocked_api_client, stream_service, streams_api): @pytest.mark.asyncio async def test_search_all_rooms(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V3RoomSearchResults, "stream/search_rooms.json" ) - + streams_api.v3_room_search_post = AsyncMock(return_value=return_object) + search_criteria = V2RoomSearchCriteria(query="query") chunk_size = 3 @@ -288,10 +296,11 @@ async def test_search_all_rooms(mocked_api_client, stream_service, streams_api): @pytest.mark.asyncio async def test_get_room_info(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V3RoomDetail, "stream/get_room_info.json" ) - + streams_api.v3_room_id_info_get = AsyncMock(return_value=return_object) + room_id = "room_id" room_detail = await stream_service.get_room_info(room_id) @@ -304,9 +313,10 @@ async def test_get_room_info(mocked_api_client, stream_service, streams_api): @pytest.mark.asyncio async def test_get_im_info(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V1IMDetail, "stream/get_im_info.json" ) + streams_api.v1_im_id_info_get = AsyncMock(return_value=return_object) im_id = "im_id" im_details = await stream_service.get_im_info(im_id) @@ -323,9 +333,10 @@ async def test_get_im_info(mocked_api_client, stream_service, streams_api): @pytest.mark.asyncio async def test_set_room_active(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( RoomDetail, "stream/deactivate_room.json" ) + streams_api.v1_room_id_set_active_post = AsyncMock(return_value=return_object) room_id = "room_id" active = False @@ -339,9 +350,10 @@ async def test_set_room_active(mocked_api_client, stream_service, streams_api): @pytest.mark.asyncio async def test_update_room(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V3RoomDetail, "stream/update_room.json" ) + streams_api.v3_room_id_update_post = AsyncMock(return_value=return_object) room_id = "room_id" room_attributes = V3RoomAttributes() @@ -356,9 +368,10 @@ async def test_update_room(mocked_api_client, stream_service, streams_api): @pytest.mark.asyncio async def test_update_im(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V1IMDetail, "stream/get_im_info.json" ) + streams_api.v1_im_id_update_post = AsyncMock(return_value=return_object) im_id = "im_id" im_attributes = V1IMAttributes() @@ -376,24 +389,26 @@ async def test_update_im(mocked_api_client, stream_service, streams_api): @pytest.mark.asyncio async def test_create_im_admin(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( Stream, "stream/create_im.json" ) + streams_api.v1_admin_im_create_post = AsyncMock(return_value=return_object) user_ids = [12334] stream = await stream_service.create_im_admin(user_ids) streams_api.v1_admin_im_create_post.assert_called_once_with( - uid_list=UserIdList(value=user_ids), session_token=SESSION_TOKEN + uid_list=user_ids, session_token=SESSION_TOKEN ) assert stream.id == "-M8s5WG7K8lAP7cpIiuyTH___oh4zK8EdA" @pytest.mark.asyncio async def test_set_room_active_admin(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( RoomDetail, "stream/deactivate_room.json" ) + streams_api.v1_admin_room_id_set_active_post = AsyncMock(return_value=return_object) room_id = "room_id" active = False @@ -407,9 +422,10 @@ async def test_set_room_active_admin(mocked_api_client, stream_service, streams_ @pytest.mark.asyncio async def test_list_streams_admin(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V2AdminStreamList, "stream/list_streams_admin.json" ) + streams_api.v2_admin_streams_list_post = AsyncMock(return_value=return_object) stream_filter = V2AdminStreamFilter() skip = 1 @@ -420,16 +436,17 @@ async def test_list_streams_admin(mocked_api_client, stream_service, streams_api filter=stream_filter, skip=skip, limit=limit, session_token=SESSION_TOKEN ) assert streams.limit == 2 - assert len(streams.streams.value) == 2 - assert streams.streams.value[0].id == "hpRd80zAUnLv3NMhLVF3Ln___o3ULKRDdA" - assert streams.streams.value[1].id == "6hEzTqQjVPLLE9KgXLvsKn___o3TtL3ddA" + assert len(streams.streams) == 2 + assert streams.streams[0].id == "hpRd80zAUnLv3NMhLVF3Ln___o3ULKRDdA" + assert streams.streams[1].id == "6hEzTqQjVPLLE9KgXLvsKn___o3TtL3ddA" @pytest.mark.asyncio async def test_list_all_streams_admin(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V2AdminStreamList, "stream/list_streams_admin.json" ) + streams_api.v2_admin_streams_list_post = AsyncMock(return_value=return_object) stream_filter = V2AdminStreamFilter() limit = 10 @@ -447,9 +464,10 @@ async def test_list_all_streams_admin(mocked_api_client, stream_service, streams @pytest.mark.asyncio async def test_list_stream_members(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V2MembershipList, "stream/list_stream_members.json" ) + streams_api.v1_admin_stream_id_membership_list_get = AsyncMock(return_value=return_object) stream_id = "stream_id" skip = 1 @@ -460,16 +478,17 @@ async def test_list_stream_members(mocked_api_client, stream_service, streams_ap id=stream_id, skip=skip, limit=limit, session_token=SESSION_TOKEN ) assert members.count == 2 - assert len(members.members.value) == 2 - assert members.members.value[0].user.user_id == 13056700579872 - assert members.members.value[1].user.user_id == 13056700579891 + assert len(members.members) == 2 + assert members.members[0].user.user_id == 13056700579872 + assert members.members[1].user.user_id == 13056700579891 @pytest.mark.asyncio async def test_list_all_stream_members(mocked_api_client, stream_service, streams_api): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( + return_object = get_deserialized_object_from_resource( V2MembershipList, "stream/list_stream_members.json" ) + streams_api.v1_admin_stream_id_membership_list_get = AsyncMock(return_value=return_object) stream_id = "stream_id" limit = 5 @@ -488,13 +507,13 @@ async def test_list_all_stream_members(mocked_api_client, stream_service, stream async def test_list_room_members( mocked_api_client, stream_service, room_membership_api ): - mocked_api_client.call_api.return_value = get_deserialized_object_from_resource( - MembershipList, "stream/list_room_members.json" + return_object = get_deserialized_object_from_resource( + List[MemberInfo], "stream/list_room_members.json" ) + room_membership_api.v2_room_id_membership_list_get = AsyncMock(return_value=return_object) room_id = "room_id" members = await stream_service.list_room_members(room_id) - members = members.value room_membership_api.v2_room_id_membership_list_get.assert_called_once_with( id=room_id, session_token=SESSION_TOKEN diff --git a/tests/core/service/user/user_service_test.py b/tests/core/service/user/user_service_test.py index 4d2ba47a..8a290813 100644 --- a/tests/core/service/user/user_service_test.py +++ b/tests/core/service/user/user_service_test.py @@ -1,5 +1,6 @@ import base64 import json +from typing import List from unittest.mock import AsyncMock, MagicMock, mock_open, patch import pytest @@ -13,22 +14,20 @@ from symphony.bdk.gen.pod_api.system_api import SystemApi from symphony.bdk.gen.pod_api.user_api import UserApi from symphony.bdk.gen.pod_api.users_api import UsersApi -from symphony.bdk.gen.pod_model.avatar_list import AvatarList +from symphony.bdk.gen.pod_model.avatar import Avatar from symphony.bdk.gen.pod_model.avatar_update import AvatarUpdate from symphony.bdk.gen.pod_model.delegate_action import DelegateAction from symphony.bdk.gen.pod_model.disclaimer import Disclaimer from symphony.bdk.gen.pod_model.feature import Feature -from symphony.bdk.gen.pod_model.feature_list import FeatureList +from symphony.bdk.gen.pod_model.user_id import UserId from symphony.bdk.gen.pod_model.followers_list import FollowersList from symphony.bdk.gen.pod_model.followers_list_response import FollowersListResponse from symphony.bdk.gen.pod_model.following_list_response import FollowingListResponse -from symphony.bdk.gen.pod_model.integer_list import IntegerList -from symphony.bdk.gen.pod_model.role_detail_list import RoleDetailList +from symphony.bdk.gen.pod_model.role_detail import RoleDetail from symphony.bdk.gen.pod_model.service_account_manifest import ServiceAccountManifest from symphony.bdk.gen.pod_model.string_id import StringId -from symphony.bdk.gen.pod_model.user_detail_list import UserDetailList +from symphony.bdk.gen.pod_model.user_detail import UserDetail from symphony.bdk.gen.pod_model.user_filter import UserFilter -from symphony.bdk.gen.pod_model.user_id_list import UserIdList from symphony.bdk.gen.pod_model.user_search_filter import UserSearchFilter from symphony.bdk.gen.pod_model.user_search_query import UserSearchQuery from symphony.bdk.gen.pod_model.user_search_results import UserSearchResults @@ -37,7 +36,6 @@ from symphony.bdk.gen.pod_model.v2_user_attributes import V2UserAttributes from symphony.bdk.gen.pod_model.v2_user_create import V2UserCreate from symphony.bdk.gen.pod_model.v2_user_detail import V2UserDetail -from symphony.bdk.gen.pod_model.v2_user_detail_list import V2UserDetailList from symphony.bdk.gen.pod_model.v2_user_list import V2UserList from tests.core.config import minimal_retry_config from tests.utils.resource_utils import ( @@ -191,7 +189,7 @@ async def test_follow_user(user_api, user_service): user_api.v1_user_uid_follow_post.assert_called_with( uid=12345, - uid_list=FollowersList(followers=UserIdList(value=[1234, 2345])), + uid_list=FollowersList(followers=[1234, 2345]), session_token="session_token", ) @@ -204,7 +202,7 @@ async def test_unfollow_user(user_api, user_service): user_api.v1_user_uid_unfollow_post.assert_called_with( uid=12345, - uid_list=FollowersList(followers=UserIdList(value=[1234, 2345])), + uid_list=FollowersList(followers=[1234, 2345]), session_token="session_token", ) @@ -224,14 +222,14 @@ async def test_get_user_detail(user_api, user_service): assert user_detail.user_attributes.user_name == "johndoe" assert user_detail.user_system_info.status == "ENABLED" - assert len(user_detail.roles.value) == 6 + assert len(user_detail.roles) == 6 @pytest.mark.asyncio async def test_list_user_details(user_api, user_service): user_api.v2_admin_user_list_get = AsyncMock() user_api.v2_admin_user_list_get.return_value = get_deserialized_object_from_resource( - V2UserDetailList, "user/list_user_detail.json" + List[V2UserDetail], "user/list_user_detail.json" ) user_detail_list = await user_service.list_user_details() @@ -249,7 +247,7 @@ async def test_list_user_details(user_api, user_service): async def test_list_all_user_details(user_api, user_service): user_api.v2_admin_user_list_get = AsyncMock() user_api.v2_admin_user_list_get.return_value = get_deserialized_object_from_resource( - V2UserDetailList, "user/list_user_detail.json" + List[V2UserDetail], "user/list_user_detail.json" ) gen = await user_service.list_all_user_details() @@ -268,7 +266,7 @@ async def test_list_all_user_details(user_api, user_service): async def test_list_user_details_by_filter(user_api, user_service): user_api.v1_admin_user_find_post = AsyncMock() user_api.v1_admin_user_find_post.return_value = get_deserialized_object_from_resource( - UserDetailList, "user/list_user_by_filter.json" + List[UserDetail], "user/list_user_by_filter.json" ) user_filter = UserFilter(status="ENABLED", role="INDIVIDUAL") @@ -287,7 +285,7 @@ async def test_list_user_details_by_filter(user_api, user_service): async def test_list_all_user_details_by_filter(user_api, user_service): user_api.v1_admin_user_find_post = AsyncMock() user_api.v1_admin_user_find_post.return_value = get_deserialized_object_from_resource( - UserDetailList, "user/list_user_by_filter.json" + List[UserDetail], "user/list_user_by_filter.json" ) user_filter = UserFilter(status="ENABLED") @@ -315,15 +313,15 @@ async def test_add_role(user_api, user_service): @pytest.mark.asyncio -async def test_list_roles(system_api, user_service): - system_api.v1_admin_system_roles_list_get = AsyncMock() - system_api.v1_admin_system_roles_list_get.return_value = get_deserialized_object_from_resource( - RoleDetailList, "user/list_roles.json" +async def test_list_roles(user_api, user_service): + user_api.v1_admin_system_roles_list_get = AsyncMock() + user_api.v1_admin_system_roles_list_get.return_value = get_deserialized_object_from_resource( + List[RoleDetail], "user/list_roles.json" ) role_list = await user_service.list_roles() - system_api.v1_admin_system_roles_list_get.assert_called_with(session_token="session_token") + user_api.v1_admin_system_roles_list_get.assert_called_with(session_token="session_token") assert len(role_list) == 12 assert role_list[0].id == "CONTENT_MANAGEMENT" @@ -345,7 +343,7 @@ async def test_remove_role(user_api, user_service): async def test_get_avatar(user_api, user_service): user_api.v1_admin_user_uid_avatar_get = AsyncMock() user_api.v1_admin_user_uid_avatar_get.return_value = get_deserialized_object_from_resource( - AvatarList, "user/list_avatar.json" + List[Avatar], "user/list_avatar.json" ) avatar_list = await user_service.get_avatar(1234) @@ -425,7 +423,7 @@ async def test_add_disclaimer(user_api, user_service): async def test_get_delegates(user_api, user_service): user_api.v1_admin_user_uid_delegates_get = AsyncMock() user_api.v1_admin_user_uid_delegates_get.return_value = deserialize_object( - IntegerList, "[7215545078461]" + List[int], "[7215545078461]" ) delegate_list = await user_service.get_delegates(1234) @@ -455,7 +453,7 @@ async def test_update_delegates(user_api, user_service): async def test_get_feature_entitlements(user_api, user_service): user_api.v1_admin_user_uid_features_get = AsyncMock() user_api.v1_admin_user_uid_features_get.return_value = deserialize_object( - FeatureList, + List[Feature], payload="[" " {" ' "entitlment": "canCreatePublicRoom",' @@ -486,7 +484,7 @@ async def test_update_feature_entitlements(user_api, user_service): await user_service.update_feature_entitlements(1234, [feature]) user_api.v1_admin_user_uid_features_update_post.assert_called_with( - uid=1234, payload=FeatureList(value=[feature]), session_token="session_token" + uid=1234, payload=[feature], session_token="session_token" ) @@ -610,7 +608,7 @@ async def test_create(user_api, user_service): assert user_detail.user_attributes.user_name == "johndoe" assert user_detail.user_system_info.status == "ENABLED" - assert len(user_detail.roles.value) == 6 + assert len(user_detail.roles) == 6 @pytest.mark.asyncio @@ -630,7 +628,7 @@ async def test_update(user_api, user_service): assert user_detail.user_attributes.user_name == "johndoe" assert user_detail.user_system_info.status == "ENABLED" - assert len(user_detail.roles.value) == 6 + assert len(user_detail.roles) == 6 @pytest.mark.asyncio @@ -659,7 +657,7 @@ async def test_list_audit_trail(audit_trail_api, user_service): ) assert len(audit_trail_initiator_list.items) == 2 - assert audit_trail_initiator_list.items[0].initiator_id == 1353716993 + assert audit_trail_initiator_list.items[0].initiator_id == "1353716993" @pytest.mark.asyncio @@ -692,8 +690,8 @@ async def test_list_all_user_audit_trail(audit_trail_api, user_service): ) assert len(audit_trail_list) == 2 - assert audit_trail_list[0]["action_name"] == "profileInfoUpdate" - assert audit_trail_list[1]["action_name"] == "userAppEntitlementInstall" + assert audit_trail_list[0].action_name == "profileInfoUpdate" + assert audit_trail_list[1].action_name == "userAppEntitlementInstall" @pytest.mark.asyncio @@ -726,10 +724,10 @@ async def test_list_all_user_audit_trail_2_pages(audit_trail_api, user_service): assert audit_trail_api.v1_audittrail_privilegeduser_get.call_count == 2 assert kwargs["after"] == "2" assert len(audit_trail_list) == 4 - assert audit_trail_list[0]["action_name"] == "profileInfoUpdate-2" - assert audit_trail_list[1]["action_name"] == "userAppEntitlementInstall-2" - assert audit_trail_list[2]["action_name"] == "profileInfoUpdate" - assert audit_trail_list[3]["action_name"] == "userAppEntitlementInstall" + assert audit_trail_list[0].action_name == "profileInfoUpdate-2" + assert audit_trail_list[1].action_name == "userAppEntitlementInstall-2" + assert audit_trail_list[2].action_name == "profileInfoUpdate" + assert audit_trail_list[3].action_name == "userAppEntitlementInstall" @pytest.mark.asyncio @@ -805,5 +803,5 @@ async def test_update_manifest_file(user_api, user_service): user_api.v1_user_manifest_own_post.assert_called_once_with( session_token="session_token", - manifest=ServiceAccountManifest(json.dumps(expected_manifest_data)), + manifest=ServiceAccountManifest(manifest=json.dumps(expected_manifest_data)), ) diff --git a/tests/ext/group_test.py b/tests/ext/group_test.py index 2632ab48..0a2cc4e7 100644 --- a/tests/ext/group_test.py +++ b/tests/ext/group_test.py @@ -14,6 +14,7 @@ from symphony.bdk.gen.group_model.group_list import GroupList from symphony.bdk.gen.group_model.member import Member from symphony.bdk.gen.group_model.owner import Owner +from symphony.bdk.gen.group_api.group_api import GroupApi from symphony.bdk.gen.group_model.read_group import ReadGroup from symphony.bdk.gen.group_model.sort_order import SortOrder from symphony.bdk.gen.group_model.status import Status @@ -73,13 +74,6 @@ def fixture_group(): return ReadGroup(type="SDL", owner_type=Owner(value="TENANT"), owner_id=123, name="SDl test") -def assert_called_idm_tokens(first_call_args, session_token=SESSION_TOKEN): - assert first_call_args.args[0] == "/idm/tokens" - params = dict(first_call_args.args[3]) - assert params["scope"] == "profile-manager" - assert first_call_args.args[4]["sessionToken"] == session_token - - def test_group_extension_initialisation(): api_client_factory = Mock() bot_session = Mock() @@ -96,8 +90,10 @@ def test_group_extension_initialisation(): @pytest.mark.asyncio -async def test_insert_group(group_service, mocked_group, api_client): - api_client.call_api.return_value = mocked_group +async def test_insert_group(group_service, mocked_group): + group_api = MagicMock(spec=GroupApi) + group_api.insert_group = AsyncMock(return_value=mocked_group) + group_service._group_api = group_api create_group = CreateGroup( type="SDL", owner_type=Owner(value="TENANT"), owner_id=190, name="SDL" @@ -106,67 +102,73 @@ async def test_insert_group(group_service, mocked_group, api_client): assert group.type == mocked_group.type assert group.name == mocked_group.name - api_client.call_api.assert_called_once() - assert api_client.call_api.call_args.args[0] == "/v1/groups" - assert api_client.call_api.call_args.kwargs["body"] == create_group + group_api.insert_group.assert_called_once() + call_kwargs = group_api.insert_group.call_args.kwargs + assert call_kwargs["create_group"] == create_group + assert call_kwargs["x_symphony_host"] == "localhost" @pytest.mark.asyncio -async def test_list_groups(group_service, mocked_group, api_client): - api_client.call_api.return_value = GroupList(data=[mocked_group]) +async def test_list_groups(group_service, mocked_group): + group_api = MagicMock(spec=GroupApi) + group_api.list_groups = AsyncMock(return_value=GroupList(data=[mocked_group])) + group_service._group_api = group_api groups = await group_service.list_groups() assert len(groups.data) == 1 - api_client.call_api.assert_called_once() - assert api_client.call_api.call_args.args[0] == "/v1/groups/type/{typeId}" + group_api.list_groups.assert_called_once() + call_kwargs = group_api.list_groups.call_args.kwargs + assert call_kwargs["x_symphony_host"] == "localhost" @pytest.mark.asyncio -async def test_list_all_groups(group_service, api_client): - api_client.call_api.return_value = get_deserialized_object_from_resource( +async def test_list_all_groups(group_service): + group_api = MagicMock(spec=GroupApi) + group_api.list_groups = AsyncMock(return_value=get_deserialized_object_from_resource( GroupList, "group/list_all_groups_one_page.json" - ) + )) + group_service._group_api = group_api gen = await group_service.list_all_groups(chunk_size=2) groups = [d async for d in gen] - args, kwargs = api_client.call_api.call_args - - assert args[0] == "/v1/groups/type/{typeId}" - assert args[3] == [("limit", 2)] + group_api.list_groups.assert_called_once() + call_kwargs = group_api.list_groups.call_args.kwargs + assert call_kwargs["limit"] == 2 assert len(groups) == 2 - assert groups[0]["name"] == "SDl test 0" - assert groups[1]["name"] == "SDl test 1" + assert groups[0].name == "SDl test 0" + assert groups[1].name == "SDl test 1" @pytest.mark.asyncio -async def test_list_all_groups_2_pages(group_service, api_client): +async def test_list_all_groups_2_pages(group_service): return_values = [ get_deserialized_object_from_resource(GroupList, "group/list_all_groups_page_1.json"), get_deserialized_object_from_resource(GroupList, "group/list_all_groups_page_2.json"), ] - - api_client.call_api.side_effect = return_values + group_api = MagicMock(spec=GroupApi) + group_api.list_groups = AsyncMock(side_effect=return_values) + group_service._group_api = group_api gen = await group_service.list_all_groups(chunk_size=2, max_number=4) groups = [d async for d in gen] - args, kwargs = api_client.call_api.call_args - - assert api_client.call_api.call_count == 2 - assert args[0] == "/v1/groups/type/{typeId}" - assert dict(args[3])["after"] == "2" - assert dict(args[3])["limit"] == 2 + assert group_api.list_groups.call_count == 2 + call_kwargs = group_api.list_groups.call_args.kwargs + assert call_kwargs["after"] == "2" + assert call_kwargs["limit"] == 2 assert len(groups) == 4 - assert groups[0]["name"] == "SDl test 0" - assert groups[1]["name"] == "SDl test 1" - assert groups[2]["name"] == "SDl test 2" - assert groups[3]["name"] == "SDl test 3" + assert groups[0].name == "SDl test 0" + assert groups[1].name == "SDl test 1" + assert groups[2].name == "SDl test 2" + assert groups[3].name == "SDl test 3" @pytest.mark.asyncio -async def test_list_groups_with_params(group_service, mocked_group, api_client): - api_client.call_api.return_value = GroupList(data=[mocked_group]) +async def test_list_groups_with_params(group_service, mocked_group): + group_api = MagicMock(spec=GroupApi) + group_api.list_groups = AsyncMock(return_value=GroupList(data=[mocked_group])) + group_service._group_api = group_api groups = await group_service.list_groups( status=Status(value="ACTIVE"), @@ -176,22 +178,23 @@ async def test_list_groups_with_params(group_service, mocked_group, api_client): sort_order=SortOrder(value="ASC"), ) assert len(groups.data) == 1 - api_client.call_api.assert_called_once() - assert api_client.call_api.call_args.args[0] == "/v1/groups/type/{typeId}" - params = dict(api_client.call_api.call_args.args[3]) - assert params["status"] == Status(value="ACTIVE") - assert params["before"] == "0" - assert params["after"] == "50" - assert params["limit"] == 50 - assert params["sortOrder"] == SortOrder(value="ASC") + group_api.list_groups.assert_called_once() + call_kwargs = group_api.list_groups.call_args.kwargs + assert call_kwargs["status"] == Status(value="ACTIVE") + assert call_kwargs["before"] == "0" + assert call_kwargs["after"] == "50" + assert call_kwargs["limit"] == 50 + assert call_kwargs["sort_order"] == SortOrder(value="ASC") @pytest.mark.asyncio -async def test_update_group(group_service, mocked_group, api_client): +async def test_update_group(group_service, mocked_group): mocked_group.name = "Updated name" mocked_group.e_tag = "e_tag" mocked_group.id = "group_id" - api_client.call_api.return_value = mocked_group + group_api = MagicMock(spec=GroupApi) + group_api.update_group = AsyncMock(return_value=mocked_group) + group_service._group_api = group_api update_group = UpdateGroup( name="Updated name", @@ -207,69 +210,82 @@ async def test_update_group(group_service, mocked_group, api_client): ) assert group.name == mocked_group.name - api_client.call_api.assert_called_once() - assert api_client.call_api.call_args.args[0] == "/v1/groups/{groupId}" - assert api_client.call_api.call_args.kwargs["body"] == update_group + group_api.update_group.assert_called_once() + call_kwargs = group_api.update_group.call_args.kwargs + assert call_kwargs["if_match"] == mocked_group.e_tag + assert call_kwargs["group_id"] == mocked_group.id + assert call_kwargs["update_group"] == update_group @pytest.mark.asyncio -async def test_update_avatar(group_service, mocked_group, api_client): +async def test_update_avatar(group_service, mocked_group): mocked_group.id = "group_id" - api_client.call_api.return_value = mocked_group + group_api = MagicMock(spec=GroupApi) + group_api.update_avatar = AsyncMock(return_value=mocked_group) + group_service._group_api = group_api image = "base_64_image" group = await group_service.update_avatar(group_id=mocked_group.id, image=image) assert group.name == mocked_group.name - api_client.call_api.assert_called_once() - assert api_client.call_api.call_args.args[0] == "/v1/groups/{groupId}/avatar" - assert api_client.call_api.call_args.kwargs["body"] == UploadAvatar(image=image) + group_api.update_avatar.assert_called_once() + call_kwargs = group_api.update_avatar.call_args.kwargs + assert call_kwargs["group_id"] == mocked_group.id + assert call_kwargs["upload_avatar"] == UploadAvatar(image=image) @pytest.mark.asyncio -async def test_get_group(group_service, mocked_group, api_client): +async def test_get_group(group_service, mocked_group): mocked_group.id = "group_id" - api_client.call_api.return_value = mocked_group + group_api = MagicMock(spec=GroupApi) + group_api.get_group = AsyncMock(return_value=mocked_group) + group_service._group_api = group_api group = await group_service.get_group(group_id=mocked_group.id) assert group.name == mocked_group.name - api_client.call_api.assert_called_once() - assert api_client.call_api.call_args.args[0] == "/v1/groups/{groupId}" + group_api.get_group.assert_called_once_with(group_id=mocked_group.id, x_symphony_host="localhost") @pytest.mark.asyncio -async def test_add_member_to_group(group_service, mocked_group, api_client): +async def test_add_member_to_group(group_service, mocked_group): mocked_group.id = "group_id" - api_client.call_api.return_value = mocked_group + group_api = MagicMock(spec=GroupApi) + group_api.add_member_to_group = AsyncMock(return_value=mocked_group) + group_service._group_api = group_api user_id = 12345 group = await group_service.add_member_to_group(group_id=mocked_group.id, user_id=user_id) assert group.name == mocked_group.name - api_client.call_api.assert_called_once() - assert api_client.call_api.call_args.args[0] == "/v1/groups/{groupId}/member" - assert api_client.call_api.call_args.kwargs["body"] == AddMember( + group_api.add_member_to_group.assert_called_once() + call_kwargs = group_api.add_member_to_group.call_args.kwargs + assert call_kwargs["group_id"] == mocked_group.id + assert call_kwargs["add_member"] == AddMember( member=Member(member_id=user_id, member_tenant=extract_tenant_id(user_id)) ) @pytest.mark.asyncio async def test_add_member_to_group_with_retries( - group_service, mocked_group, api_client, login_client + group_service, mocked_group ): - login_client.call_api.return_value = JwtToken(access_token="access token") - + authentication_api = group_service._oauth_session._authentication_api + authentication_api.idm_tokens_post = AsyncMock(return_value=JwtToken(access_token="access token")) + mocked_group.id = "group_id" - api_client.call_api.side_effect = [ApiException(status=401), mocked_group] + group_api = MagicMock(spec=GroupApi) + group_api.add_member_to_group = AsyncMock(side_effect=[ApiException(status=401), mocked_group]) + group_service._group_api = group_api user_id = 12345 group = await group_service.add_member_to_group(group_id=mocked_group.id, user_id=user_id) - login_client.call_api.assert_called_once() + authentication_api.idm_tokens_post.assert_called_once() assert group.name == mocked_group.name - assert api_client.call_api.call_count == 2 - assert api_client.call_api.call_args.args[0] == "/v1/groups/{groupId}/member" - assert api_client.call_api.call_args.kwargs["body"] == AddMember( + assert group_api.add_member_to_group.call_count == 2 + call_kwargs = group_api.add_member_to_group.call_args.kwargs + assert call_kwargs["group_id"] == mocked_group.id + assert call_kwargs["add_member"] == AddMember( member=Member(member_id=user_id, member_tenant=extract_tenant_id(user_id)) ) @@ -285,47 +301,50 @@ async def test_oauth_session_initialisation(auth_session, retry_config): @pytest.mark.asyncio -async def test_oauth_session_refresh(auth_session, retry_config, login_client): +async def test_oauth_session_refresh(auth_session, retry_config): bearer_token = "bearer token" token = JwtToken(access_token=bearer_token) - login_client.call_api.return_value = token - oauth_session = OAuthSession(login_client, auth_session, retry_config) + oauth_session = OAuthSession(AsyncMock(), auth_session, retry_config) + oauth_session._authentication_api.idm_tokens_post = AsyncMock(return_value=token) await oauth_session.refresh() - login_client.call_api.assert_called_once() - assert_called_idm_tokens(login_client.call_api.call_args) + oauth_session._authentication_api.idm_tokens_post.assert_called_once_with( + session_token=SESSION_TOKEN, scope="profile-manager" + ) assert oauth_session._bearer_token == bearer_token @pytest.mark.asyncio -async def test_oauth_session_refresh_with_retries(auth_session, retry_config, login_client): +async def test_oauth_session_refresh_with_retries(auth_session, retry_config): bearer_token = "bearer token" - login_client.call_api.side_effect = [ + oauth_session = OAuthSession(AsyncMock(), auth_session, retry_config) + oauth_session._authentication_api.idm_tokens_post = AsyncMock(side_effect=[ ApiException(status=401), JwtToken(access_token=bearer_token), - ] + ]) authenticator = AsyncMock(BotAuthenticator) auth_session._authenticator = authenticator updated_session_token = "updated session token" authenticator.retrieve_session_token.return_value = updated_session_token - oauth_session = OAuthSession(login_client, auth_session, retry_config) await oauth_session.refresh() - assert login_client.call_api.call_count == 2 - assert_called_idm_tokens(login_client.call_api.call_args_list[0]) - assert_called_idm_tokens(login_client.call_api.call_args_list[1], updated_session_token) + assert oauth_session._authentication_api.idm_tokens_post.call_count == 2 + first_call_kwargs = oauth_session._authentication_api.idm_tokens_post.call_args_list[0].kwargs + assert first_call_kwargs["session_token"] == SESSION_TOKEN + second_call_kwargs = oauth_session._authentication_api.idm_tokens_post.call_args_list[1].kwargs + assert second_call_kwargs["session_token"] == updated_session_token assert oauth_session._bearer_token == bearer_token @pytest.mark.asyncio -async def test_oauth_settings(auth_session, retry_config, login_client): +async def test_oauth_settings(auth_session, retry_config): bearer_token = "bearer token" token = JwtToken(access_token=bearer_token) - login_client.call_api.return_value = token - oauth_session = OAuthSession(login_client, auth_session, retry_config) + oauth_session = OAuthSession(AsyncMock(), auth_session, retry_config) + oauth_session._authentication_api.idm_tokens_post = AsyncMock(return_value=token) settings = await oauth_session.get_auth_settings() assert settings == { @@ -336,18 +355,18 @@ async def test_oauth_settings(auth_session, retry_config, login_client): "value": "Bearer bearer token", } } - login_client.call_api.assert_called_once() + oauth_session._authentication_api.idm_tokens_post.assert_called_once() @pytest.mark.asyncio async def test_oauth_settings_does_not_refresh_when_called_twice( - auth_session, retry_config, login_client + auth_session, retry_config ): bearer_token = "bearer token" token = JwtToken(access_token=bearer_token) - login_client.call_api.return_value = token - oauth_session = OAuthSession(login_client, auth_session, retry_config) + oauth_session = OAuthSession(AsyncMock(), auth_session, retry_config) + oauth_session._authentication_api.idm_tokens_post = AsyncMock(return_value=token) await oauth_session.get_auth_settings() settings = await oauth_session.get_auth_settings() @@ -359,4 +378,4 @@ async def test_oauth_settings_does_not_refresh_when_called_twice( "value": "Bearer bearer token", } } - login_client.call_api.assert_called_once() + oauth_session._authentication_api.idm_tokens_post.assert_called_once() diff --git a/tests/resources/application/list_user_apps_str.json b/tests/resources/application/list_user_apps_str.json new file mode 100644 index 00000000..42c294be --- /dev/null +++ b/tests/resources/application/list_user_apps_str.json @@ -0,0 +1,35 @@ +[ + { + "appId": "djApp", + "appName": "Dow Jones", + "listed": "TRUE", + "install": "FALSE" + }, + { + "appId": "spcapiq", + "appName": "S&P Capital IQ Data", + "listed": "TRUE", + "install": "FALSE" + }, + { + "appId": "selerity", + "appName": "Selerity Context", + "listed": "TRUE", + "install": "TRUE", + "products": [ + { + "appId": "selerity", + "name": "Standard", + "subscribed": true, + "type": "default" + }, + { + "appId": "selerity", + "name": "Premium", + "sku": "AcDccU53SsY", + "subscribed": false, + "type": "premium" + } + ] + } +] \ No newline at end of file diff --git a/tests/resources/group/list_all_groups_one_page.json b/tests/resources/group/list_all_groups_one_page.json index b44bd52e..f24152fa 100644 --- a/tests/resources/group/list_all_groups_one_page.json +++ b/tests/resources/group/list_all_groups_one_page.json @@ -2,8 +2,8 @@ "data": [ { "name": "SDl test 0", - "owner_id": 123, - "owner_type": "TENANT", + "ownerId": 123, + "ownerType": "TENANT", "profile": { "display_name": "Demo Group 00", "email": "email@sdl.symphony.com", @@ -15,8 +15,8 @@ }, { "name": "SDl test 1", - "owner_id": 124, - "owner_type": "TENANT", + "ownerId": 124, + "ownerType": "TENANT", "profile": { "display_name": "Demo Group 01", "email": "email@sdl.symphony.com", diff --git a/tests/resources/group/list_all_groups_page_1.json b/tests/resources/group/list_all_groups_page_1.json index 01a15192..56c990e8 100644 --- a/tests/resources/group/list_all_groups_page_1.json +++ b/tests/resources/group/list_all_groups_page_1.json @@ -2,8 +2,8 @@ "data": [ { "name": "SDl test 0", - "owner_id": 123, - "owner_type": "TENANT", + "ownerId": 123, + "ownerType": "TENANT", "profile": { "display_name": "Demo Group 00", "email": "email@sdl.symphony.com", @@ -15,8 +15,8 @@ }, { "name": "SDl test 1", - "owner_id": 124, - "owner_type": "TENANT", + "ownerId": 124, + "ownerType": "TENANT", "profile": { "display_name": "Demo Group 01", "email": "email@sdl.symphony.com", diff --git a/tests/resources/group/list_all_groups_page_2.json b/tests/resources/group/list_all_groups_page_2.json index 13df9492..954dc50d 100644 --- a/tests/resources/group/list_all_groups_page_2.json +++ b/tests/resources/group/list_all_groups_page_2.json @@ -2,8 +2,8 @@ "data": [ { "name": "SDl test 2", - "owner_id": 123, - "owner_type": "TENANT", + "ownerId": 123, + "ownerType": "TENANT", "profile": { "display_name": "Demo Group 00", "email": "email@sdl.symphony.com", @@ -15,8 +15,8 @@ }, { "name": "SDl test 3", - "owner_id": 124, - "owner_type": "TENANT", + "ownerId": 124, + "ownerType": "TENANT", "profile": { "display_name": "Demo Group 01", "email": "email@sdl.symphony.com", diff --git a/tests/resources/message_response/blast_message.json b/tests/resources/message_response/blast_message.json index 45577370..8378a581 100644 --- a/tests/resources/message_response/blast_message.json +++ b/tests/resources/message_response/blast_message.json @@ -20,7 +20,18 @@ "userAgent": "Agent-2.63.0-SNAPSHOT-Windows 10-10.0", "originalFormat": "com.symphony.messageml.v2", "sid": "a4d08d18-0729-4b54-9c4568da", - "attachments": ["attachment", "preview"] + "attachments": [ { + "id": "attachment_id_1", + "name": "file1.txt", + "size": 1024, + "images": [] + }, + { + "id": "preview_id_1", + "name": "file1_preview.png", + "size": 5120, + "images": [] + }] }, { "messageId": "-AANBHKtUC-2q6_0WSjBGX___pHnSfBKdA-2", @@ -41,7 +52,18 @@ "userAgent": "Agent-2.63.0-SNAPSHOT-Windows 10-10.0", "originalFormat": "com.symphony.messageml.v2", "sid": "a4d08d18-0729-4b54-9c4568da", - "attachments": ["attachment", "preview"] + "attachments": [ { + "id": "attachment_id_1", + "name": "file1.txt", + "size": 1024, + "images": [] + }, + { + "id": "preview_id_1", + "name": "file1_preview.png", + "size": 5120, + "images": [] + }] } ] } \ No newline at end of file diff --git a/tests/resources/message_response/update_message.json b/tests/resources/message_response/update_message.json index cd217aa9..08fb43e5 100644 --- a/tests/resources/message_response/update_message.json +++ b/tests/resources/message_response/update_message.json @@ -15,7 +15,7 @@ "userAgent": "Agent-20.13.0-SNAPSHOT-Linux-4.14.243-185.433.amzn2.x86_64", "originalFormat": "com.symphony.messageml.v2", "sid": "b10d692f-899e-4601-b946-879da15c0462", - "silent": "true", + "silent": true, "replacing": "PUQj2xA0eniBOfeNTbTu8X___oNdE9uDbQ", "initialTimestamp": 1634820957308, "initialMessageId": "PUQj2xA0eniBOfeNTbTu8X___oNdE9uDbQ", diff --git a/tests/resources/session/get_session.json b/tests/resources/session/get_session.json index 8e64d25d..43e3b36c 100644 --- a/tests/resources/session/get_session.json +++ b/tests/resources/session/get_session.json @@ -1,9 +1,9 @@ { "id": 7696581394433, - "email_address": "admin@symphony.com", - "first_name": "Symphony", - "last_name": "Admin", - "display_name": "Symphony Admin", + "emailAddress": "admin@symphony.com", + "firstName": "Symphony", + "lastName": "Admin", + "displayName": "Symphony Admin", "title": "Administrator", "company": "Acme", "username": "admin@symphony.com", diff --git a/tests/resources/user/list_all_audit_trail_one_page.json b/tests/resources/user/list_all_audit_trail_one_page.json index 0daa0ec7..dce008b0 100644 --- a/tests/resources/user/list_all_audit_trail_one_page.json +++ b/tests/resources/user/list_all_audit_trail_one_page.json @@ -7,7 +7,7 @@ "newValue": "[Content Management,Individual,User Provisioning,Audit Trail Management]", "oldValue": "[Content Management,Individual,User Provisioning]", "date": 1551888601279, - "initiatorId": 1353716993, + "initiatorId": "1353716993", "initiatorUsername": "admin@symphony.com", "initiatorEmailAddress": "admin@symphony.com", "affectedId": 1353716999, @@ -22,7 +22,7 @@ "appName": "APP_NAME", "attribute": "roles", "date": 1551888601279, - "initiatorId": 1356993, + "initiatorId": "1356993", "initiatorUsername": "admin@symphony.com", "initiatorEmailAddress": "admin@symphony.com", "affectedId": 1356999, diff --git a/tests/resources/user/list_all_audit_trail_page_1.json b/tests/resources/user/list_all_audit_trail_page_1.json index 6ee03606..3c25dec7 100644 --- a/tests/resources/user/list_all_audit_trail_page_1.json +++ b/tests/resources/user/list_all_audit_trail_page_1.json @@ -7,7 +7,7 @@ "newValue": "[Content Management,Individual,User Provisioning,Audit Trail Management]", "oldValue": "[Content Management,Individual,User Provisioning]", "date": 1551888601279, - "initiatorId": 1353716993, + "initiatorId": "1353716993", "initiatorUsername": "admin@symphony.com", "initiatorEmailAddress": "admin@symphony.com", "affectedId": 1353716999, @@ -22,7 +22,7 @@ "appName": "APP_NAME", "attribute": "roles", "date": 1551888601279, - "initiatorId": 1356993, + "initiatorId": "1356993", "initiatorUsername": "admin@symphony.com", "initiatorEmailAddress": "admin@symphony.com", "affectedId": 1356999, diff --git a/tests/resources/user/list_all_audit_trail_page_2.json b/tests/resources/user/list_all_audit_trail_page_2.json index df6a310d..eff40c0d 100644 --- a/tests/resources/user/list_all_audit_trail_page_2.json +++ b/tests/resources/user/list_all_audit_trail_page_2.json @@ -7,7 +7,7 @@ "newValue": "[Content Management,Individual,User Provisioning,Audit Trail Management]", "oldValue": "[Content Management,Individual,User Provisioning]", "date": 1551888601279, - "initiatorId": 1353716993, + "initiatorId": "1353716993", "initiatorUsername": "admin@symphony.com", "initiatorEmailAddress": "admin@symphony.com", "affectedId": 1353716999, @@ -22,7 +22,7 @@ "appName": "APP_NAME", "attribute": "roles", "date": 1551888601279, - "initiatorId": 1356993, + "initiatorId": "1356993", "initiatorUsername": "admin@symphony.com", "initiatorEmailAddress": "admin@symphony.com", "affectedId": 1356999, diff --git a/tests/resources/user/list_audit_trail.json b/tests/resources/user/list_audit_trail.json index d2830482..bdc62ff1 100644 --- a/tests/resources/user/list_audit_trail.json +++ b/tests/resources/user/list_audit_trail.json @@ -12,15 +12,15 @@ "oldValue": "[Content Management,Individual,User Provisioning]", - "date": 1551888601279, + "date": "1551888601279", - "initiatorId": 1353716993, + "initiatorId": "1353716993", "initiatorUsername": "admin@symphony.com", "initiatorEmailAddress": "admin@symphony.com", - "affectedId": 1353716999, + "affectedId": "1353716999", "affectedUsername": "test", @@ -45,15 +45,15 @@ "oldValue": "[Content Management,Individual,User Provisioning]", - "date": 1551888601279, + "date": "1551888601279", - "initiatorId": 1356993, + "initiatorId": "1356993", "initiatorUsername": "admin@symphony.com", "initiatorEmailAddress": "admin@symphony.com", - "affectedId": 1356999, + "affectedId": "1356999", "affectedUsername": "test.test", diff --git a/tests/utils/resource_utils.py b/tests/utils/resource_utils.py index 44e03a77..baaaf8cb 100644 --- a/tests/utils/resource_utils.py +++ b/tests/utils/resource_utils.py @@ -1,8 +1,7 @@ import json from pathlib import Path -from symphony.bdk.gen.api_client import validate_and_convert_types -from symphony.bdk.gen.configuration import Configuration +from typing import get_origin, get_args, List def get_resource_filepath(relative_path, as_text=True): @@ -23,25 +22,51 @@ def get_deserialized_object_from_resource(return_type, resource_path): def deserialize_object(model, payload): - """Deserializes the passed payload to an instance of the specified model - Disregards unknown fields is + """Deserializes the passed payload to an instance of the specified model. - :param model: OpenApi generated model - :param payload: json payload to be deserialized + :param model: The model to deserialize to (Pydantic model, primitive type, or List[...] of those). + :param payload: JSON payload to be deserialized. :return: Instance of the model """ - try: - test_data = json.loads(payload) - except json.JSONDecodeError: - test_data = payload - return validate_and_convert_types( - input_value=test_data, - required_types_mixed=(model,), - path_to_item=["test_data"], - spec_property_naming=True, - _check_type=True, - configuration=Configuration(discard_unknown_keys=True), - ) + # If the model is a List[...] type + origin = get_origin(model) + if origin in (list, List): + (inner_model,) = get_args(model) + + # Ensure payload is parsed JSON list + if isinstance(payload, str): + try: + data = json.loads(payload) + except json.JSONDecodeError: + raise ValueError("Expected JSON array for List[...] model") + else: + data = payload + + if not isinstance(data, list): + raise ValueError(f"Expected list for {model}, got {type(data)}") + + return [ + deserialize_object(inner_model, item) # recursively call + for item in data + ] + + # Handle single objects (Pydantic models) + if hasattr(model, "from_json"): + if isinstance(payload, str): + return model.from_json(payload) + else: + return model.model_validate(payload) # Pydantic v2 compatibility + + # Fallback for primitive types + if isinstance(payload, str): + try: + data = json.loads(payload) + except json.JSONDecodeError: + data = payload + else: + data = payload + + return model(data) def get_config_resource_filepath(relative_path):